Discord.js DiscordAPI 错误:未知表情符号 - 对嵌入做出反应

Discord.js DiscordAPI Error: Unknown Emoji - Reacting to an Embed(Discord.js DiscordAPI 错误:未知表情符号 - 对嵌入做出反应)
本文介绍了Discord.js DiscordAPI 错误:未知表情符号 - 对嵌入做出反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

这是我的代码:

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.

这篇关于Discord.js DiscordAPI 错误:未知表情符号 - 对嵌入做出反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Discord.js Arguments With Spaces(Discord.js 带空格的参数)
DiscordJS fetching more then 100 messages(DiscordJS 获取超过 100 条消息)
my discord.js bot doesn#39;t reply to a user message even if there isn#39;t any error(即使没有任何错误,我的 discord.js 机器人也不会回复用户消息)
Make a bot wait for some time before continuing the code(在继续代码之前让机器人等待一段时间)
Invalid Form Body in Discord.js ban command(Discord.js 禁止命令中的无效表单正文)
Set Discord Bot Activity to the number of Online users. Discord.js(将 Discord Bot 活动设置为在线用户数.不和谐.js)