Ask coding questions

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

When I run the warn command ( 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
bendev9 (7)

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