【发布时间】:2021-10-25 23:10:04
【问题描述】:
试图让机器人从私人消息中复制用户的消息并将其发送到隐藏频道。然后,如果我反应积极???机器人向公共频道发送消息,如果反应消极???? - 从隐藏频道中删除消息。
console.log("-----DM-----")
console.log(message.content)
console.log(message.author.tag)
console.log("-----DM-----")
message.author.send("Anonim został wysłany!");
client.channels.cache.get('880177470366699570').send({
embed: {
color: 0x8b0000,
author: {
name: "Otrzymałem anonima!",
icon_url: message.author.avatarURL
},
title: "Treść:",
description: message.content,
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "Staff"
}
}
}).then(function (message) {
message.react("????")
message.react("????")
if (emoji.name == '????' && reaction.count > 1) {
client.channels.cache.get('880154569223577623').send({
embed: {
color: 0x8b0000,
author: {
name: "Otrzymałem anonima!",
icon_url: message.author.avatarURL
},
title: "Treść:",
description: message.content,
timestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "Staff"
}
}
})
}
}
)}
我的问题/错误是:
(node:16588) UnhandledPromiseRejectionWarning: ReferenceError: emoji is not defined
at E:\DiscordBot\anon.js:179:13
at processTicksAndRejections (internal/process/task_queues.js:95:5)
如何定义表情符号? 我尝试了 emoji = reaction.emoji 但没有用。
【问题讨论】:
-
正如错误所说,
emoji未定义,查看您的代码,它确实未定义,除非您在代码中的其他地方定义了它,但从错误来看,我对此表示怀疑。emoji变量应该在messageReact事件中定义, -
当我尝试 'messageReactionAdd' 机器人将嵌入消息发送到另一个频道(成功的一半)但没有 message.content,空消息。
标签: javascript discord bots message emoji