1 | initial version |
To turn a cog into a command group with a prefix, the following steps can be taken:
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.prefix = "!"
...
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.prefix = "!"
@commands.group(name="mycommandgroup")
async def my_command_group(self, ctx):
pass
...
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.prefix = "!"
@commands.group(name="mycommandgroup")
async def my_command_group(self, ctx):
pass
@my_command_group.command(name="mycommand")
async def my_command(self, ctx):
pass
...
bot = commands.Bot(command_prefix="!")
bot.add_cog(MyCog(bot))
Now, users can use commands within the command group by typing the prefix followed by the command group name and the command name. For example: "!mycommandgroup mycommand".