[英]Python doesn't think Emoji[1️⃣] = 1️⃣
So I have an emoji (1️⃣) that you can react to.所以我有一个表情符号(1️⃣)你可以做出反应。 I have the bot look for a reaction being added which it runs except it doesn't think emoji = 1️⃣.
我让机器人寻找正在添加的反应,它运行除了它不认为 emoji = 1️⃣。 It comes back "no".
它回来了“不”。
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload):
channel = await self.client.fetch_channel(payload.channel_id)
message = await channel.fetch_message(payload.message_id)
user = await self.client.fetch_user(payload.user_id)
emoji = payload.emoji
if user.id != self.client.user.id:
message_id = message.id
if message.id == message_id:
if emoji == "1️⃣":
print("yes")
else:
print("no")
payload.emoji
is an instance of the PartialEmoji
class, you can't compare it to a string. payload.emoji
是PartialEmoji
类的一个实例,您不能将其与字符串进行比较。 Try尝试
if emoji.name == "1️⃣":
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.