如何让 discord 机器人输出所有用户输入而不仅仅是第一个输入?

How to get a discord bot to output everything user inputs instead of just the first input?

我正在尝试获得一个机器人,它会重复用户输入的内容,次数与用户指定的次数一样多。
我 运行 遇到的问题是,如果用户键入:!repeat 5 x y,机器人只会重复 x 5 次,而不是 x y 5 次。

这是我正在尝试的代码 运行:

@bot.command()
async def repeat(times: int, content="Repeating..."):
    for i in range(times):
        if times > 10:
            await bot.say("Cannot spam more than 10 messages at a time.")
            return
        else:
            await bot.say(content)

您可以使用 keyword-only argument syntax 并执行类似

的操作
@bot.command()
async def repeat(times: int, *,content="Repeating..."):
  for i in range(times):
    if times > 10:
      await bot.say("Cannot spam more than 10 messages at a time.")
      return
    else:
      await bot.say(content)