Pycord Bot won't change role color

Viewed 119

The problem

I'm making a bot using Pycord, with a command that changes a role color. The command takes two arguments: the id of the role and the color to change the role to. Here is my code:

@bot.command()
async def colorChange(ctx, roleID: int, roleColor: discord.Color):
    role = ctx.guild.get_role(roleID)
    await role.edit(color=roleColor)

However, when I run the command like this:

b?colorChange 917642721018142720 Blue

It simply does nothing, there is no error or anything.

What I've tried

To figure out if the code was actually running, I added this below it:

await ctx.send('Hello World')

And this runs perfectly fine, and the bot sends a message saying Hello World. But the role's color still won't change. I've also tried:

  • Checking if the role id is valid and using different colors.
  • Removing the roleColor argument itself, and just changing the given role to Blue

But nothing will work. Can someone please help?

1 Answers

Change the 'color' parameter to 'colour', as it says in the documentation right here discord.Role.edit

await role.edit(colour=roleColor)

Also remember that it is not possible for the bot to edit roles that are above him, so if you try this, you won't get any error message, it just won't work.

Related