假设我有以下命令和子命令:
@commands.group()
async def channel(self, ctx, channel_name_or_id):
# convert channel_name_or_id to channel object
@channel.command()
async def get_mention(ctx, channel_object):
await ctx.send(channel_object.mention)
@channel.command()
async def get_id(ctx, channel_object):
await ctx.send(channel_object.id)
我希望父命令将名称或 id 转换为对象,然后将该对象传递给 subcommands。有没有办法做到这一点?像ctx.invoked_subcommand.pass(channel_object)
什么?