B
B
BARBARISKA02020-12-01 20:34:16
Python
BARBARISKA0, 2020-12-01 20:34:16

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

1 answer(s)
S
soremix, 2020-12-01
@SoreMix

Pass the parameter colourinstead of color
upd: although as I understand it, you can just use color, but you
need permissions https://discordpy.readthedocs.io/en/latest/api.htm...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question