Comments (10)
Sure. PRs are always welcome. Documenting things is hard, and sometimes we don't explain everything 100%. I'll leave this issue open so we can clean up these sections when we get a chance.
from discord-api-docs.
- Presence is a pretty standard term in online chat apps. It refers to their status. (in the case of Discord, Online/Idle/Offline & their playing game)
- When their presence is updated (and also whenever we feel like it) - the server may decide to send presences to the client to ensure it's in sync.
- Presences and roles are per-guild, whereas the user object is global.
- The user object can be partial. The only field that it must contain is the "id" - every other field is optional, and won't be sent if they aren't updated.
from discord-api-docs.
I'm still confused; are online/idle/offline and current game not global? Are you saying that this event may be fired when a user changes role?
from discord-api-docs.
online/idle/offline and current game not global?
No. They are not. Each guild manages user presence individually. A user can be online in one guild but offline in another. Although this isn't exposed currently to regular users, our infra supports this. One example would be a bot that's using gateway sharding and is only connected to one shard. They'd only be online in a fraction of their total guilds.
from discord-api-docs.
Are you saying that this event may be fired when a user changes role?
No. That will be fired as GUILD_MEMBER_UPDATE
- the roles
is just in there for the sake of ensuring that the client is in sync. Please see this section on eventual consistency https://discordapp.com/developers/docs/reference#consistency.
from discord-api-docs.
No. That will be fired as GUILD_MEMBER_UPDATE - the roles is just in there for the sake of ensuring that the client is in sync.
Alright, fair enough, I can always use it for that as well.
A user can be online in one guild but offline in another. One example would be a bot that's using gateway sharding and is only connected to one shard.
Is this something that will likely happen in the actual client in the future? Handling this in my bot for the sake of completeness might be something to do, but is that something that should really be happening with well-behaved clients?
from discord-api-docs.
Is this something that will likely happen in the actual client in the future?
Yes it's on the road-map. Well-behaved clients may also be partially offline at times during a netsplit scenario. (The client would see an "unavailable guilds" message.) Additionally, your bot may have unavailable guilds from time to time too. This shouldn't be too often, and usually only happens when we're experiencing internal issues such as a netsplit between our nodes caused by internal networking issues.
from discord-api-docs.
Yeah, I'm already handling unavailable guilds at the moment. My system is really not designed for users with multiple online/offline/away statuses though, that's going to take some lateral thinking... I'll figure something out.
By the by, does this mean I'll receive a presence update for every guild my bot is in if a user shares multiple guilds with it?
from discord-api-docs.
Ultimately, we may deliver the presence update event once, multiple times or not at all. For those purposes, if you want to fire an event when a presence updates, you should compare it to the previous presence update known by the bot, and only bubble up the event if something actually changes.
By the by, does this mean I'll receive a presence update for every guild my bot is in if a user shares multiple guilds with it?
Yes. The way our client structures this data is to have global user objects - and guild member objects per guild which hold the status.
from discord-api-docs.
Hmm.. Okay, thanks, I think I can work with that. It might be worth adding some of this to the presence update part of the docs, though, so you don't keep getting people with these questions :P
from discord-api-docs.
Related Issues (20)
- Discord
- /members-search doesn't fetch a newly joined member's information HOT 2
- Incorrect MIME Type in Content_Type for Certain Filename Extensions HOT 3
- found a way to spam people
- `Get /webhooks/{webhook.id}/{webhook.token}` also returns user object HOT 3
- Bots can interact with lootboxes endpoints HOT 1
- Emoji Rendering on Message Application Commands (User App) HOT 2
- Linked role `name_localizations` and `description_localizations` are not working HOT 3
- `avatar_decoration` field not found HOT 2
- Incorrect 400 message from /guilds/{guild.id}/incident-actions
- User who have MANAGE_ROLES but not MANAGE_CHANNEL could escalate this permission HOT 6
- Missing documentation for `recurrence_rule` in Guild Scheduled Event
- Code blocks in embeds now dont display emojis at random HOT 3
- Unclear status of permissions HOT 2
- Audit logs of some integration changes have wrong sender info on them HOT 1
- Emoji affects on the link markdown (only in text-message) HOT 1
- Guild_join_request_update events sent HOT 1
- Wrong encoding in file preview message with Buffer HOT 2
- Followed Announcement Channel Webhooks use User details instead of Server details for Published Messages HOT 2
- Saving problem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord-api-docs.