[英]is there can delete message when click this reaction emoji DIscord.js
[英]Custom reaction emoji discord js: "Client undefined"
我正在嘗試做一個 roleReact 機器人。 常用表情符號有效,我基於discord.js
的官方文檔中的一些,但是當涉及到自定義表情符號反應時,我不斷得到結果
客戶端未定義
到目前為止,這是我的代碼:
case "react":
// this works
message.react("😄").then(reaction => console.log(typeof reaction));
//I keep getting a client undefiend error here
message.react( client.emojis.get("410431571083132933")).then(reaction => console.log(typeof reaction));
message.react("410431571083132933").then(reaction => console.log(typeof reaction));
break;
有人知道這個問題的解決方案嗎?
您確定這是有效的表情符號 ID 嗎?
您不能右鍵單擊表情符號和復制 ID。 這將復制消息的 ID。
要獲取表情符號類型的 ID \:emoji:
=> <:emoji:123123123123>
使用該 ID,您可以對消息做出反應。
message.react(client.emojis.get("123123123123"))
.then(reaction => console.log(typeof reaction));
或者,如果您從某處復制並粘貼該代碼, client
是Discord.Client()
的默認設置,但有些人改用bot
。
嘗試使用bot
而不是client
您可以刪除整個獲取表情符號的部分,看看是否可行:
message.react("<:emojiNameGoesHere: 410431571083132933>").then(reaction => console.log(typeof reaction));
這是實際發送的文本,discord 只是在客戶端刪除它並用表情符號替換它。
您的機器人必須與您要使用的一些自定義表情符號在服務器上
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.