比方说,当我键入某个命令时,它将重复“ Hello”。并在一定时间内发送该消息。你会怎么写。
答案 0 :(得分:0)
channel = someChannel
for i in range(10):
await channel.send("Hello")
将发送10次“ Hello”
答案 1 :(得分:0)
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