【发布时间】:2021-01-28 01:29:53
【问题描述】:
当我对频道“idere”中的一条消息做出反应时 ????然后它将消息发送到“idere-accepted”,当我对 ???? 做出反应时然后它将消息发送到“idere-declined”,这就是我所做的
但是当我已经准备好对一条消息做出反应并想要对另一条以“idere”发送的消息做出反应时,问题就出来了????然后它在“idere-accepted”中发送消息 2 次,当我第三次做出反应时,它发送消息 3 次问题是一样的????
const emojiChannelName = "idere";
const emojiChannelNameAccepted = "idere-accepted";
const emojiChannelNameDeclined = "idere-declined";
client.on("message", async (message) => {
if (message.guild.id === guildID) {
if (message.channel.name === emojiChannelName) {
if (message.author.id !== botID) {
await message.react("????");
await message.react("????");
}
}
client.on("messageReactionAdd", async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
let channelAccept = message.guild.channels.cache.find(
(channel) => channel.name === emojiChannelNameAccepted
);
let channelDeclined = message.guild.channels.cache.find(
(channel) => channel.name === emojiChannelNameDeclined
);
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.message.channel.name === emojiChannelName) {
if (reaction.emoji.name === "????") {
if (user.id === config.owner) {
if(message.author.id !== botID) {
let accept = new Discord.MessageEmbed()
.setColor("GREEN")
.setTitle("Ide accepted")
.setDescription(
`${message.author} Havde en ide som er\n**${reaction.message.content}**\n(Testing)`
)
.setTimestamp()
.setFooter(`Accepted af ${user.username}`);
await channelAccept.send(accept);
reaction.message.delete();
}
} else {
reaction.message.reactions
.resolve("????")
.users.remove(reaction.users.cache.keyArray()[1]);
}
}
if (reaction.emoji.name === "????") {
if (user.id === config.owner) {
let declined = new Discord.MessageEmbed()
.setColor("RED")
.setTitle("Ide declined")
.setDescription(
`${message.author} Havde en ide som er\n**${reaction.message.content}**\n(Testing)`
)
.setTimestamp()
.setFooter(`Declined af ${user.username}`);
await channelDeclined.send(declined);
reaction.message.delete();
} else {
reaction.message.reactions
.resolve("????")
.users.remove(reaction.users.cache.keyArray()[1]);
}
}
}
});
}
});```
【问题讨论】:
标签: discord discord.js