T
T
Telmor2021-10-17 09:30:06
Python
Telmor, 2021-10-17 09:30:06

How to change the color of an existing discord role using discord.py?

I have a role. I want to change the color that the user specifies in it. How can I do it?
Code (example):

@commands.command(
        aliases=['role']
    )
    async def edit_role(self, ctx, role, color):
        role = discord.utils.get(ctx.message.guild.roles, name = role)
        await role.edit(colour=color)
        await ctx.send('Успешно!')

(PS I do everything in cogs, but I will be glad for any answer)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavlosik, 2021-10-21
@Pavlosik

The bot can create a role
but not change it in any way

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question