Python 如何在discordpy中获取命令后的文本
如何在discordpy中获取命令后的文本?例如“!say hello”如何获取hello?您可以将参数作为命令中的参数Python 如何在discordpy中获取命令后的文本,python,discord,Python,Discord,如何在discordpy中获取命令后的文本?例如“!say hello”如何获取hello?您可以将参数作为命令中的参数 @commands.command() 异步定义(ctx,*,参数): 等待ctx发送(args)#发送整个 #另一种方法 @commands.command() async def say_first(ctx,args): wait ctx.send(args)#只发送第一个单词 #另一种方法 @commands.command() 异步定义列表(ctx,*参数): wai
@commands.command()
异步定义(ctx,*,参数):
等待ctx发送(args)#发送整个
#另一种方法
@commands.command()
async def say_first(ctx,args):
wait ctx.send(args)#只发送第一个单词
#另一种方法
@commands.command()
异步定义列表(ctx,*参数):
wait ctx.send(args)#将args作为列表发送
范例
!say hello there
> hello there
!say_first hello there
> hello
!say_list hello there
> ('hello', 'there')
参考资料: