discord.py invoke subcommand



基本上我想调用一个子命令。如果我在这里有这样的代码,有趣的是子命令:

@client.group()
async def help(ctx):
if ctx.invoked_subcommand is None:
await ctx.send("Hello")
@help.command()
async def fun(ctx):
if ctx.invoked_subcommand is None:
await ctx.send("Fun")

我想要另一个命令,例如:async def invoke_fun(ctx),它调用子命令fun,但不调用help命令。感谢您提前提供的帮助。

检查此项:

@client.command()
async def invoke_fun(ctx)
command = client.get_command("help fun")
ctx.command = command
ctx.invoked_subcommand = command
await client.invoke(ctx)

最新更新