Oreo
Oreo

Reputation: 3

Discord bot cannot see member updates

I have writing a discord bot to mess around with using discord.py and discord.ext.commands, and so far it has been working as intended. However, no matter what I try I can't seem to get it to see a member update. Here is the code that sets up intents

#declare our intents
intents = discord.Intents.default()
intents.members = True
intents.presences = True
#client settings, load intents
client = discord.Client(intents=intents)
client = commands.Bot(command_prefix = "!", guild_subscriptions=True)

And here is the code that should see a member update

@client.event
async def on_member_update(before, after):
    print("just saw a member update!")

I have also enabled both presence and member privileged intents in the application portal, and the bot has full admin privileges on the server and the highest rank below server owner. Is there an issue with the code, or is some other factor stopping it from seeing the updates? Does it need to be manually given some permission? It can see on_voice_state_update and on_message events using mostly the same code in the same server.

Upvotes: 0

Views: 157

Answers (1)

duckboycool
duckboycool

Reputation: 2455

You are assigning a Client with the members intent enabled, and them immediately overwriting it with a Bot that has the default intents (and therefore the members intent disabled).

Pass your intents into the Bot creation instead.

#declare our intents
intents = discord.Intents.default()
intents.members = True
intents.presences = True
#client settings, load intents
client = commands.Bot(command_prefix = "!", guild_subscriptions=True, intents=intents)

Upvotes: 1

Related Questions