class Foo(commands.Cog):
cmds = set()
def deco(cmd, cmds=cmds):
cmds.add(cmd)
return cmd
def cog_check(self, ctx):
return ctx.command in self.cmds
@deco
@commands.command()
async def allowed(self, ctx):
await ctx.send('allowed')
@commands.command()
async def denied(self, ctx):
await ctx.send('illegal')neither of these commands run. why is that? |
Answered by
Rapptz
Sep 30, 2020
Replies: 2 comments
|
For now I will use |
0 replies
|
Commands in cogs undergo copy operations to allow multiple cog instances to have separate command instances. Comparison between instances is generally not allowed (evident by the fact there's no |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Commands in cogs undergo copy operations to allow multiple cog instances to have separate command instances.
Comparison between instances is generally not allowed (evident by the fact there's no
__eq__or even__hash__) -- usingCommand.qualified_nameis the proper solution here.