Getting None In Message.guild.get_member_named("member_name")
I'm getting NoneType in message.guild.get_member_named('Testing Account') and there is a person/account named Testing Account in the discord server.
Solution 1:
First, make sure your bot has members
intent enabled in the developer portal
Enable intents in the code, and pass them in your bot/client with the intents
kwarg.
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='!', intents=intents)
"If your bot tracks presence data, you may need the presence intent to receive presence event data." - Discord Developer Portal
You can find more about intents or privileged intents at Privileged Intents - Discord & A Primer to Gateway Intents - Discord.py
Solution 2:
If .get_member_named()
is returning None
there could be many reasons causing that. You can check if...
- you typed the name of the account correctly
- the account is in the guild in which the message was sent
- the bot has permissions to view the user's profile
- your bot has logged in correctly
If none of those are the case you can have a look at the get_member_named()
documentation or use IDs instead of a name (IDs usually work much more reliably).
Post a Comment for "Getting None In Message.guild.get_member_named("member_name")"