当我对频道“ idere”中的消息作出反应时,?将消息发送至“ idere-accepted”,当我对react做出反应时,它将消息发送至“ idere-declined”,这就是我的意思已经
但是当我都准备好对一条消息做出反应并且想要对另一条消息进行反应时,这是一个问题第三次发送消息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]);
}
}
}
});
}
});```
答案 0 :(得分:0)
在发送邮件的地方,您可以尝试返回邮件。
试试这个:
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);
return reaction.message.delete(); //returns the 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);
return reaction.message.delete(); //returns the message delete
} else {
reaction.message.reactions
.resolve("?")
.users.remove(reaction.users.cache.keyArray()[1]);
}
}
}
});
}
});