我想在别人发送消息时编辑他们的用户名,添加一个来显示他们已经发送了多少条消息,我该如何在discord.py中做到这一点?
我正在设置一个机器人,在他们每次发送消息时,通过编辑他们的用户名来+1到一个数字。
keyword = "thing"
@bot.event
async def on_message(message):
message_text = message.content.strip().upper()
if keyword in message_text:
await ctx.send('. . .')
我尝试过这样做,如果它检测到关键字,就只输出文本。
我希望得到的输出是。。。但是什么都没有发生,没有错误消息,什么都没有,什么也不做。
如有任何帮助,将不胜感激,谢谢!
发布于 2019-04-11 03:56:15
message_text
全部为大写字符,但"thing"
为小写
keyword = "thing"
@bot.event
async def on_message(message):
message_text = message.content.strip().lower()
if keyword in message_text:
await message.channel.send('. . .')
请注意,您不能执行ctx.send
,因为您不在命令中,因此不能访问调用上下文对象。
https://stackoverflow.com/questions/55620194
复制相似问题