I'm trying to get a bot that will repeat what a user inputs, as many times as the user specifies.
The issue I'm running into is that if the user types: !repeat 5 x y
, the bot will only repeat x
5 times, and not x y
5 times.
This is the code I'm trying to run:
@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)
You can use the keyword-only argument syntax and do something like