Search code examples
pythondiscorddiscord.pybotsroles

Discord.py: How to change role color?


So i created this role for my discord bot and i want to change his color to yellow. I don't know why it won't change the color. This is my code, can anyone help me with it?

@bot.command(pass_context=True)
async def add_role(ctx):
    member = ctx.author
    role = discord.utils.get(member.guild.roles, name="Spike")
    await member.add_roles(role)
    await role.edit(colour=discord.colour(0xFFFF00))
    print("done")

edit: It doesn't print the "done"


Solution

  • Ok so, my problem was that my bot.command wasn't working because I was using bot and client method at the same time. I wasn't aware that they can't work togheter, so I decided to only use bot, and now everything is working.