This is my cog
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
cmds = get_commands()
for command in cmds:
@commands.command(name=command['name'], description=command['description'], extras=command, case_insensitive=True)
async def cmd(self, ctx, member:Member):
embed = await generate_embed(ctx.command.extras['query'])
await ctx.send(member.mention, embed=embed)
self.bot.add_command(cmd)
For now the commands are added to the bot and I access them from bot.commands()
, but I want them to be added to the cog so I can use cog.get_commands()
Is this possible ? I tried setattr(MyCog, command['name'], cmd)
but it doesn't work