how do i fix a program when it doesn’t tell me an error?

ctx.message.author returns you discord.Member so you cannot compare it with a string. You should use ctx.author.name and ctx.author.discriminator. name returns you the name, in this case it’s ItsJustLogic, and discriminator returns you 9893. So you can check your name with combining them.

Also, you can’t add role with the name of the role, you have to get role with discord.utils.get or guild.get_role() then you can add the role.

async def role(ctx):
    member = ctx.author
    if f'{member.name}#{member.discriminator}' == 'ItsJustLogic#9893':
        role = discord.utils.get(ctx.guild.roles, name='The Great Mountain Chicken')
        # or you can use role = ctx.guild.get_role(role id)
        await member.add_roles(role)
        await ctx.send('done')
    else:
        await ctx.send('no... go away')

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top