本文介紹了Discord.py 檢查用戶是否對特定的表情符號做出反應的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想知道是否有辦法使用 Discord.py 來檢查某人是否對特定表情符號做出了反應.
I was wondering if there's a way to check if someone reacted with a specific emoji using Discord.py.
推薦答案
下面的命令會回復一條消息,然后等待一個 :smile:
或 :custom_emoji:
對該消息的反應.
The below command will reply with a message, then wait for either a :smile:
or :custom_emoji:
reaction on that message.
from discord.utils import get
from discord.ext import commands
bot = commands.Bot("!")
@bot.command(pass_context=True)
async def checkreacts(ctx):
msg1 = await bot.say("React to me!")
custom_emoji = get(ctx.message.server.emojis, name="custom_emoji")
reaction = await bot.wait_for_reaction(['N{SMILE}', custom_emoji], msg1)
await bot.say("You responded with {}".format(reaction.emoji))
bot.run("token")
這篇關于Discord.py 檢查用戶是否對特定的表情符號做出反應的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!