Give roles in

I am trying to make a bot that makes a channel and gives you a role when you enter a command, I have been trying to get the role part working for quite a while but I always end up with errors after errors- this is my current code-

@bot.command(name= 'playfata')
async def playfata(ctx):
    member =
    role = discord.utils.get(member.guild.roles, name="Currently Playing")
    if role in member.roles:
        await ctx.send("You already have that role")
        await member.add_roles(role)

and this is the error I end up receiving with this one-

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'

I tried almost everything I could find on the internet and nothing seems to have helped.

Read more here:

Content Attribution

This content was originally published by Luvya Aggarwal at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: