Answer the question
In order to leave comments, you need to log in
role.edit not working, how to fix it?
@bot.event
async def rainbowrole():
for guild in bot.guilds:
for role in guild.roles:
if role.name == 'rainbow':
delay = 1
colours = [discord.Color.orange(),discord.Color.gold(),discord.Color.magenta(),discord.Color.red(),discord.Color.blue(),discord.Color.teal(),discord.Color.green(),discord.Color.purple()]
while not bot.is_closed():
await role.edit(color=random.choice(colours))
await asyncio.sleep(delay)
else:
pass
@bot.event
async def on_ready():
bot.loop.create_task(rainbowrole())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question