[英]Python discord bot warn specific person
I am doing a bot that will warn a person if the word in the message is blacklisted.我正在做一个机器人,如果消息中的单词被列入黑名单,它会警告一个人。 The problem is that when the bot writes @person#tag it is not a mention, but just a text.问题是当机器人写@person#tag 时,它不是提及,而只是一个文本。 How do I improve it?我该如何改进它? Here is my code:这是我的代码:
badwords = ["lal", "sas"]
for word in badwords:
if message.content.find(word) != -1:
await message.channel.send("-warn @" + str(message.author))
Try:尝试:
badwords = ["lal", "sad"]
for word in badwords:
if message.content.find(word) != -1:
await message.channel.send(f"-warn {message.author.mention}")
This makes it so that it mentions the author who sent the message这使得它提到了发送消息的作者
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.