Ask coding questions

← Back to all posts
ctx.guild not working discord.py
isaiah08 (88)

When I run the warn command (maincommands.py line 28) on my discord bot, it gives an error.

And it doesn't! But that's not what the code says. It says ctx.guild, not MainCommands.guild! What is wrong?

Answered by bendev9 (7) [earned 5 cycles]
View Answer
Comments
hotnewtop
bendev9 (7)

Because all commands in a cog pass a self parameter. You need to put async def command(self, ctx): #continue with code