你会如何让discordbot一遍又一遍地发送相同的消息(python)



假设当我键入某个命令时,它会重复"你好"并发送该消息一定次数。你会怎么写呢。

channel = someChannel
for i in range(10):
await channel.send("Hello")

将发送";你好"10倍

from discord.ext import commands
client = commands.Bot(command_prefix='/')
@client.command()
async def repeat(ctx, msg, reps):
for i in range(reps):
await ctx.send(msg)

用户输入/repeat Hello 10

机器人输出'Hello' 10 times

最新更新