hevn
hevn

Reputation: 143

How do I get the discord.py intents to work?

I am trying to make a bot that welcomes people to the server that it's in and all of the code works except for the on_member_join event because it utilizes the new intents. I googled on how to work with the intents and tried everything but it still isn't working.

intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix=',', intents = intents)

How do I fix this?

Upvotes: 14

Views: 80588

Answers (4)

aph
aph

Reputation: 327

What you want is to add this piece of code at the top when creating your client:

intents = discord.Intents.all()
client = commands.Bot(command_prefix=',', intents=intents)

This code above will use ALL intents avaliable

Upvotes: 7

Zhandos
Zhandos

Reputation: 1

The code worked for me after I entered the correct arguments:

await message.channel.send(response['choices'][0]['text'])

Upvotes: 0

Deepak Raj
Deepak Raj

Reputation: 501

It may be you don't have enabled the permissions. checkout https://discord.com/developers/applications/

Enable The member's intent permission

  • Privileged Gateway Intents
    • SERVER MEMBERS INTENT

Upvotes: 2

Łukasz Kwieciński
Łukasz Kwieciński

Reputation: 15689

intents = discord.Intents.default()
intents.members = True

client = commands.Bot(command_prefix=',', intents=intents)

You also have to enable privileged intents in the developer portal

A Primer Gateway to Intents

Upvotes: 19

Related Questions