What I have is a command that assigns a role. ;assigntestrole <@user>. I've tried multiple different ways of getting a member object including client.fetch_user, getting the object through a guild and other stuff. I keep getting NoneType objects. Here's my code so far:
import discord
client = discord.Client()
TOKEN = 'MYTOKEN'
prefix = ';'
@client.event
async def on_message(message):
if str(message.content)[0] != prefix:
return
user = str(message.content).split(' ')[1]
guild = client.get_guild(message.guild.id)
user_obj = guild.get_member(int(user[2:-1]))
print(user_obj)
client.run(TOKEN)
The output I'm getting is None no matter which method I use (tried client.fetch_member(int(user[2:-1])), discord.utils.get(message.guild.members, id=int(user[2:-1]) and others). Any ideas as to what might be causing such behavior?