'How do I fix commands check error in discordpy?
So it seems that my check is not working, I believe the function is setup correctly but I may be wrong how should I go about fixing this error?
@client.command()
@commands.check(is_server_owner)
async def serversetup(guild,ctx):
await guild.create_role(name='safe')
await ctx.send('Please put the safe role above the AntiNuke role so those people will not be punished by the antinuke! | Server is setup!')
Here is the error I am getting
Ignoring exception in command serversetup:
Traceback (most recent call last):
File "/home/runner/AntiNuke/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/AntiNuke/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 855, in invoke
await self.prepare(ctx)
File "/home/runner/AntiNuke/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 778, in prepare
raise CheckFailure('The check functions for command {0.qualified_name} failed.'.format(self))
discord.ext.commands.errors.CheckFailure: The check functions for command serversetup failed.
Here is the is_server_owner function
def is_server_owner(ctx):
return ctx.message.author.id == ctx.guild.owner
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
