@bot.command()
async def slowmode(ctx, arg):
# do something...
await ctx.send('slowmode set to ' + str(arg))
…并用-slowmode off或-slowmode hello调用它
对于第二种情况:
@bot.group(invoke_without_command=True)
async def slowmode(ctx):
await ctx.send('You must provide a subcommand, for example `-slowmode on` or `-slowmode off`; see `-help` for more')
@slowmode.command(name='on')
async def slowmode_enable(ctx):
# do something...
await ctx.send('slowmode is set to on')
@slowmode.command(name='off')
async def slowmode_disable(ctx):
# do something...
await ctx.send('slowmode is set to off')
如果您使用的是^{} ,那么据我所知,命令名中不能有空格。但是,您可以:
对于第一种情况,您可以执行以下操作:
…并用
-slowmode off
或-slowmode hello
调用它对于第二种情况:
…调用} exception
-slowmode
将显示错误消息,-slowmode on
或-slowmode off
将运行相应的命令,-slowmode hello
将导致^{因为看起来您想要添加一个参数,所以您可以这样做:
它将被调用为
-slowmode off
或-slowmode any
这可能是最好的办法
相关问题 更多 >
编程相关推荐