【发布时间】:2019-06-20 10:34:33
【问题描述】:
我正在尝试让机器人重复用户输入的内容,重复用户指定的次数。
我遇到的问题是,如果用户输入:!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)
【问题讨论】:
标签: python discord repeat discord.py python-3.7