javascript - 自定义 react 表情符号不和谐 js : "Client undefined"

标签 javascript emoji discord discord.js

我正在尝试做一个 roleReact 机器人。股票表情符号正在工作,我基于 discord.js 的官方文档,但当涉及到自定义表情符号 react 时,我不断得到结果

client undefined

这是我到目前为止的代码:

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));

或者,如果您从某处复制并粘贴该代码,clientDiscord.Client() 的默认值,但有些人使用 bot相反。
尝试一下bot而不是client

关于javascript - 自定义 react 表情符号不和谐 js : "Client undefined",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49345220/

相关文章:

javascript - Google Apps 脚本中的数组 "includes"方法失败

UITableViewAutomaticDimension 未在 UITableviewCell 的 UILabel 中使用表情符号字符设置正确的高度

python - 如何检查用户是否提供了参数 discord.py

gradle - 无法在 gradle 中配置属性文件

javascript - 根据参数将消息发送到特定 channel

javascript - 通过多个步骤处理多个 Promise

javascript - Jquery - optgroup hide() 在单击之前不会刷新下拉列表

javascript - Node.js 文件观看基本示例

python - 从 Python 中的字符串中删除表情符号

reactjs - 提及列表和表情符号顶部位置(Draft.js)