【发布时间】:2021-04-18 19:15:36
【问题描述】:
我一直在尝试用 discord.py 制作一个不和谐的机器人。我知道如何让机器人向指定用户发送消息,但我想知道,有没有办法将消息发送给定次数?如果是这样,我该怎么做?
例如,如果用户键入 !dm @discorduser hello 5,机器人将向指定用户发送“hello”5 次。
到目前为止,我的代码是:
import discord
from discord.ext import commands
client = commands.Bot(command_prefix='.')
@client.event
async def on_ready():
print('Bot is ready.')
@client.command()
async def spam(ctx, member: discord.Member, *, content):
channel = await member.create_dm()
await channel.send(content)
client.run('bot token')
【问题讨论】:
-
到目前为止你做了什么?
标签: discord discord.py discord.py-rewrite