我无法像在不和谐机器人上使用表情符号的用户反应一样更新嵌入。
let avaEmbed = new EmbedBuilder()
.setTitle(title)
.setDescription(`\`\`\`plaintext\n${desc}\n\`\`\``)
.setColor(0x45d6fd)
.addFields({ name: `Offtank`, value: "Some values here"});
const reply = await interaction.editReply({ embeds: [avaEmbed] });
await reply.react(hammer);
await reply.react(mace);
await reply.react(ironroot);
await reply.react(great_arcane);
await reply.react(one_hand_arcane);
await reply.react(holy_staff);
await reply.react(spirit_hunter);
await reply.react(realm_breaker);
await reply.react(shadow_caller);
await reply.react(chill_howl);
await reply.react(weeping);
client.on('messageReactionAdd', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (reaction.emoji.name == '⬅️'){
avaEmbed.setFields({ name: "Offtank", value: user.id });
await reply.edit({ embeds: [avaEmbed] });
}
console.log(`${reaction.message.author}'s message "${reaction.message.content}" gained a reaction!`);
});
我确实在代码中尝试了很多选项,但没有一个能引导我找到答案
我尝试了另一种方法,但过滤器仍然不起作用,并且嵌入的编辑仍然有问题。 const offtankFilter = (reaction, user) =>reaction.emoji === 狼牙棒 && user.id === 交互.user.id; const ironrootFilter = (reaction, user) =>reaction.emoji === 狼牙棒 && user.id === 交互.user.id;
const ironroots = reply.createReactionCollector(ironrootFilter, {time: 900000, dispose: false});
const offtanks = reply.createReactionCollector(offtankFilter, {time: 900000, dispose: false});
const nickname = `<@${interaction.user.id}>`;
offtanks.on("collect", r => {
console.log("MASUK OFFTANK")
avaEmbed.setFields({ name: "Offtank", value: `${mace} ${nickname}`});
reply.edit({ embeds: [avaEmbed] });
offtankcount += 1;
});
ironroots.on("collect", r => {
console.log("MASUK IRON ROOT")
avaEmbed.setFields({ name: "IronRoot", value: `${ironroot} ${nickname}`});
reply.edit({ embeds: [avaEmbed] });
ironrootcount += 1;
});