【发布时间】:2020-12-24 22:36:49
【问题描述】:
我正在尝试创建反应消息,但每当我尝试在 .then 中使用 console.log 时,它只会在消息被删除后执行。
async execute(message) {
const role = message.guild.roles.cache.find(r => r.name == 'Founder');
if (!role) return message.channel.send(`**${message.author.username}**, role not found`);
await message.delete();
const filter = (reaction) => reaction.emoji.name === '✅';
const ReactionMessage = await message.channel.send('React to this message to get the Founder role');
ReactionMessage.react('✅');
ReactionMessage.awaitReactions(filter, { max: 10, time: 15000 })
.then(collected => console.log(collected.size))
.catch(err => console.error(err));
}
我的最终目的是让它为所有对其做出反应的用户添加一个角色,但它甚至不会在我删除消息之前 console.log 收集的大小。任何人都可以帮助我完成这项工作吗?
【问题讨论】:
标签: javascript discord discord.js