Skip to content
Advertisement

Changing color of a discord role

Everything is set up right, the bot is in the discord, connected, etc. This code:

JavaScript

Gives this error:

JavaScript

If anyone can find where I went wrong or any errors I’ve made, please help!

Advertisement

Answer

I would use the discord.Color.random() function for that as it looks like the problem occurs in your color-line.

Re-write your code to the following:

JavaScript

What did we do?

  • Imported from discord.utils import get
  • Changed the way we get the role: (get(guild.roles, name="Rainbow tester") or role = discord.utils.get(message.guild.roles, name='Rainbow tester')
  • Used the discord.Color.random() function to choose a random color
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement