mcdonalds291
mcdonalds291

Reputation: 2404

Command groups (subcommands) using discord.py while using cogs

How would I use command groups (subcommands) in discord.py while using cogs? Would it be the same as normal? Normal meaning without using cogs? Or would I have to do something extra. I've looked over the discord.py docs but couldn't seem to find anything. It would be great if someone could show me an example of how I can use command groups with cogs.

I've tried the following:

#This is in a cog
@bot.group(pass_context=True)

but my code linter keeps saying that bot is undefined.

When I try :

#This is in a cog
@self.bot.group(pass_context=True)

Its saying self is undefined.

Upvotes: 0

Views: 2235

Answers (1)

Kelo
Kelo

Reputation: 1893

Whilst in a cog, instead of using bot, use commands. e.g.

@commands.group(pass_context=True)

Upvotes: 2

Related Questions