我正在尝试做一个roleReact机器人。股票表情符号可以正常工作,我基于discord.js的官方文档,但是谈到自定义表情符号反应时,我一直得到结果


  客户端未定义


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

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

09-17 19:40