A moderation bot, you can ban, mute, unmuteThe WebSocket API is used to receive events from Discord, including message creation, message deletion, user kick/ban events, user permission updates, and many more. Communication from a bot to the WebSocket API on the other hand is more limited. A bot uses the WebSocket API to request a connection, identify itself, heartbeat, manage voice connections, and do a few more fundamental things. You can read more details at Discord’s gateway documentation (a single connection to the WebSocket API is referred to as a gateway). For performing other actions, the REST API is used.
Events from the WebSocket API contain a payload including information that depends on the type of the event. For example, all Message Create events will be accompanied by a user object representing the author of the message. However, the user object alone does not contain all of the information there is to know about the user. For example, there is no information included about the user’s permissions. If you require more information, you could query the REST API for it, but for reasons explained further in the next section, you should generally access the cache that you should have built from payloads received from previous events instead. There are a number of events that deliver payloads relevant to a user’s permissions, including but not limited to Guild Create, Guild Role Update, and Channel Update.
A bot can be present in a maximum of 2,500 guilds per WebSocket connection. In order to allow a bot to be present in more guilds, the bot must implement sharding and open several separate WebSocket connections to Discord. If your bot runs inside of a single process on a single node, this is just added complexity for you that may seem unnecessary. But if your bot is very popular and needs to have its back-end distributed across separate nodes, Discord’s sharding support makes this much easier than it would be otherwise
Reviews can be left only by registered users. All reviews are moderated by top.gg admins. Please make sure to check our guidelines before posting.
No reviews here yet!