I have been trying to make my discord bot create multiple roles through a command. But it simply doesn't work. Here is what I have done so far:
@commands.command()async def create_roles(self, ctx):guild = self.client.get_guild(783547639944839178)channel = self.client.get_channel(809683610058752010)await guild.create_role(name="red", color=discord.Color.value('F51720'))await guild.create_role(name="skyblue", color=discord.Colour.value('11A7BB'))await guild.create_role(name="yellow", color=discord.Colour.value('F8D210'))await channel.send("Done.")
When I run this code I get this error:
Ignoring exception in command create_roles:
Traceback (most recent call last):File "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrappedret = await coro(*args, **kwargs)File "C:\Users\wave computer\PycharmProjects\pythonProject\cogs\roles.py", line 14, in create_rolesawait guild.create_role(name="red", colour=discord.Colour.value('F51720'))
TypeError: 'member_descriptor' object is not callableThe above exception was the direct cause of the following exception:Traceback (most recent call last):File "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\ext\commands\bot.py", line 902, in invokeawait ctx.command.invoke(ctx)File "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\ext\commands\core.py", line 864, in invokeawait injected(*ctx.args, **ctx.kwargs)File "C:\Users\wave computer\PycharmProjects\pythonProject\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrappedraise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'member_descriptor' object is not callable
Any help would be appreciated!