【发布时间】:2021-05-23 05:24:24
【问题描述】:
我正在为我的服务器中没有它的用户进行“硝基替换”,当有人发送动画表情符号 :test: 而他们没有硝基时,机器人会删除该消息,然后发送动画表情符号。
role = ["-『????』· ????????????????-????????????????????"]
@bot.listen("on_message")
async def nitro(msg):
if ":" == msg.content[0] and ":" == msg.content[-1] and role in msg.author.roles:
emoji_name = msg.content[1:-1]
for emoji in msg.guild.emojis:
if emoji_name == emoji.name:
await msg.channel.send(f"{msg.author.mention}{str(emoji)}")
await msg.delete()
机器人运行,但由于某种原因,当包含 and role in msg.author.roles: 部分时它不起作用。它只是留下了我的:test: 文本
机器人应该如何工作与它是如何工作的:
我做错了什么?
【问题讨论】:
标签: python discord discord.py