問題描述
這是我的代碼:
client.on('message', message => {
if (message.content.startsWith("!embed")) {
const embed = new Discord.MessageEmbed()
.setColor(0xffffff)
.setFooter(`Page 1`)
message.channel.send(':rewind::fast_forward:'); //this works
//but this doesn't
message.channel.send(embed).then(embedMessage => {
embedMessage.react(":rewind:");
});
});
我可能有一個隱藏的問題或沒有提供正確的參數(shù).我查看了 類似的先前提出的問題 并嘗試實現(xiàn)它,但它沒用,可能已經(jīng)過時了.
I may have a hidden issue or not provided the correct parameters. I have looked at a similar previously asked question and tried implementing it, but it didn't work, may be outdated.
相反,我收到一個錯誤:
Instead, I receive an error:
UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Emoji
我使用的表情符號在標準表情符號庫中提供,:rewind:
The emoji I'm using is provided in the standard emoji library, :rewind:
推薦答案
Discord.Js 不處理帶有 Discord 用戶端 :rewind:
內(nèi)容的表情符號.Discord.js 使用 unicode 來發(fā)送和接收表情符號,除了自定義表情符號,這里使用 ID.
Discord.Js does not handle emojis with the Discord User Side :rewind:
stuff. Discord.js is using unicode to send and receive emojis, except for custom emojis, IDs are used there instead.
這意味著您應該改用以下代碼.
This means that you should use the following code instead.
embedMessage.react("?");
Unicode 表情符號可以通過轉(zhuǎn)義"找到.Discord 中的表情符號或使用類似:https://getemoji.com/.
The Unicode emojis can be found by "escaping" the emoji in Discord or using something like: https://getemoji.com/.
轉(zhuǎn)義是通過在表情符號前面使用來實現(xiàn)的,你可能從
中知道這一點.通過輸入 :rewind:
,結(jié)果將如下所示.
The escaping works by using in front of the emoji, you might know this from
. By putting :rewind:
the result will look as follows.
復制 Unicode 表情符號時,請確保刪除其中的所有空格.
When copying the Unicode emoji make sure to delete any spaces off of it.
這篇關于Discord.js DiscordAPI 錯誤:未知表情符號 - 對嵌入做出反應的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!