Discord.js DiscordAPI错误:未知表情符号-对嵌入进行反应 [英] Discord.js DiscordAPI Error: Unknown Emoji - Reacting to an Embed

查看:78
本文介绍了Discord.js DiscordAPI错误:未知表情符号-对嵌入进行反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

  client.on('message',message => {如果(message.content.startsWith(!embed")){const embed = new Discord.MessageEmbed().setColor(0xffffff).setFooter(`第1页`)message.channel.send(':rewind :: fast_forward:');//这有效//但这不是message.channel.send(embed).then(embedMessage => {embedMessage.react(:rewind:");});}); 

我可能有一个隐藏的问题,或者没有提供正确的参数.我查看了

在复制Unicode表情符号时,请确保删除其中的所有空格.

Here's my code:

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

The emoji I'm using is provided in the standard emoji library, :rewind:

解决方案

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("⏪");

The Unicode emojis can be found by "escaping" the emoji in Discord or using something like: https://getemoji.com/.

The escaping works by using \ in front of the emoji, you might know this from \n. By putting \:rewind: the result will look as follows.

When copying the Unicode emoji make sure to delete any spaces off of it.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆