【发布时间】:2023-04-09 16:40:01
【问题描述】:
我正在使用 client.wait_for 命令收集用户的消息,并且我想知道一种可以识别消息是否为表情符号(默认或自定义)的方法。我尝试使用 guild.fetch_emoji 和 client.get_emoji 来检测它是否是正确的表情符号。我是否必须通过多个函数传递消息?
while continue_function:
user_msg = await self.bot.wait_for('message', check=lambda message: message.author == ctx.author and message.channel == ctx.channel)
emoji = self.bot.get_emoji(user_msg.content)
emoji2 = ctx.guild.fetch_emoji(user_msg.content)
print(emoji,emoji2)
【问题讨论】:
-
self.bot.get_emoji()不带字符串。它需要一个不和谐 ID(表情符号 ID),然后它将通过机器人的缓存进行搜索。与guild.fetch_emoji相同
标签: python discord.py emoji