首页 > 解决方案 > !say discord.py 重写命令

问题描述

这是我的代码


@bot.command()
async def say(ctx, message=None):
  await ctx.message.delete()
  await ctx.send(message)

但是,如果我这样做!!说我是一只狗,机器人会说只有我是

你能帮我吗?

标签: discorddiscord.py

解决方案


那是因为空格是参数分隔符。如果您想*在函数中使用带空格的参数。像这样:

@bot.command()
async def say(ctx,*,message=None):
  await ctx.message.delete()
  await ctx.send(message)


推荐阅读