question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Presence updates should trigger GuildMemberUpdated

See original GitHub issue

Up to commit 3bd920ce66d6f7ff24bdf6e7077ea24499ddb9c5 I used UserPresenceUpdated to track when someone comes online or goes offline in order to update user counter on a web widget (which is per guild). Since the merge there is no way to retrieve information about guild where that event happened from event itself since it’s passing only 2 SocketUser parameters.

Even if I resort to extensive checking in which guilds user is joined there is this problem that we now treat UserUpdated as global event but it’s in fact not. Event is fired per guild, not per user, meaning if 1 user is in 3 guilds where bot resides his single status change will result in 3 identical event executions, that can’t be intended.

public DiscordWidgetService(IDependencyMap map)
{
    client.UserUpdated += Client_UserUpdated;
}

async Task Client_UserUpdated(SocketUser arg1, SocketUser arg2)
{
    await Console.Out.WriteLineAsync($"UserUpdated fired for {arg2.Username}");
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Auralyticalcommented, Mar 31, 2017

Funny since I talked to Jake 3 weeks before that and was told to do it globally. Will ask around =\

Edit: Oh… the user is global and presence isn’t? Ugh. Have I mentioned how much I hate PRESENCE_UPDATE?

1reaction
khionucommented, Mar 24, 2017

Our options are limited, because of the way the Discord API is structured. We’ve discussed this issue extensively, and this is the best we can do, for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Presence updates should trigger GuildMemberUpdated #588
Since the merge there is no way to retrieve information about guild where that event happened from event itself since it's passing only...
Read more >
Discord.js - guildMemberUpdate not being called except ...
With the following code, the guildMemberUpdate event does not call for any user modification at all except for the bot user. What could...
Read more >
guildmemberupdate event only occurs when bot gets updated ...
Coding example for the question guildmemberupdate event only occurs when bot gets updated-discord.js.
Read more >
Documentation — Gateway Events
Used to trigger the initial handshake with the gateway. ... presence? update presence object, Presence structure for initial presence information, -.
Read more >
Gateway - Discord Developer Portal
Guild Member Update is sent for current-user updates regardless of whether the GUILD_MEMBERS intent is set. Guild Create and Request Guild Members are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found