【发布时间】:2021-03-28 17:18:01
【问题描述】:
我一直在尝试在 python 中创建一个不和谐机器人(使用 discord.py),它可以在用户输入命令时键入消息(在我的例子中是 !spam)。这是我整理的代码。
@client.command()
async def spam(ctx, leng, tim,*,msg):
import time
leng = int(leng); tim = int(tim)
if leng > 10 :
await ctx.send('Please do not spam too much. The limit is 10 messages.')
else:
for i in range(leng) :
await ctx.send(msg)
time.sleep(tim)
有谁知道我可以放入的任何代码,可以使机器人以使用该命令的用户的身份键入消息? (所以看起来像是用户输入了消息而不是机器人)。
提前致谢。
【问题讨论】:
标签: python discord bots discord.py