@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())
colour
вместо color