Skip to content

Gateway intents and what to do in case Discord borks things again

Alpatron edited this page Dec 23, 2020 · 1 revision

Hello, me

I just updated Reg Bot to work after Discord pushed a breaking change with gateway intents (read up on the discord.py documentation site). Yeah, I know I am only a month and a half late. Anyhow, the fix was simply to enable the member intent and just leave the rest of the code as is. So that in the potential future I needn't look through the code and documentation completely blind, I've prepared some notes for me: The only place the disabling of the member intent would should affect is the activityReport function. An important function used therein, getPlayersWithApprovedCharacter, works by querying the entire member list (this would be broken) of the server and then filtering those members that have at least one character role. A fix would be to use the already existing function getPlayersInCharacterSheetChannel and filter those players that are still on the server and have at least one character role. However, there may be some problems with this approach still: various functions may will return discord.User objects instead of discord.Member (important, as discord.User doesn't contain any per-guild information, like the user's roles); this could be remedied by using some of the functions described in the retrieving members section of the discord.py documentation.

Anyhow, me, I hope this will help me in the future if I need to deal with this stuff again.

Clone this wiki locally