问题描述
这是我的代码:
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:"); }); });
我可能有一个隐藏的问题或没有提供正确的参数.我查看了 类似的先前提出的问题 并尝试实现它,但它没用,可能已经过时了.
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: 内容的表情符号.Discord.js 使用 unicode 来发送和接收表情符号,除了自定义表情符号,这里使用 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 表情符号可以通过转义"找到.Discord 中的表情符号或使用类似:https://getemoji.com/.
The Unicode emojis can be found by "escaping" the emoji in Discord or using something like: https://getemoji.com/.
转义是通过在表情符号前面使用来实现的,你可能从 中知道这一点.通过输入 :rewind:,结果将如下所示.
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.