【发布时间】:2019-12-11 22:43:06
【问题描述】:
所以我想实现报告和禁止系统,我决定使用嵌入消息并添加反应。版主可以同意也可以不同意。例如,一旦 10 位版主同意投诉,则此消息中提到的用户应被禁止或踢出。
我曾想过使用client.on('messageReactionAdd', (messageReaction, user) => {}),但它只检查缓存 消息。然后我找到了关于反应的 discordjs.guide,他们展示了如何使用client.on('raw', (event) => {}),但它很久以前就被放弃了,我什至没有发现任何关于这个官方 Discord.js 文档的提及。消息有.awaitReactions(filter, [options]),但我必须以某种方式标记投票消息,然后以某种超级复杂的client 方法搜索它们。
这是我所拥有的:
const service = client.channels.get('id');
let user = msg.mentions.users.first();
if (!user) {
msg.reply('Couldn\'t find the user!')
return 1;
}
args.shift();
let reason = args.join(' ').trim();
if (!reason) {
msg.reply('No reason to create a complaint!')
return 1;
}
msg.channel.send(`I've created and sent a user complaint about ${user.tag}!)`)
.catch((e) => console.log(e));
msg.delete();
const emb = new Discord.RichEmbed()
.setTitle('User complaint')
.addField('Who?', `**User: ${user.tag}**`)
.addField('Reason?', `**Reson: ${reason}**`)
.setColor('#ff7b00')
.setFooter('Please take action');
service.send(emb)
.then(async msg => {
await msg.react('✅')
msg.react('❌')
})
.catch(e => {
console.error()
msg.reply('Couldn\'t send a user complaint!');
return 1;
})
有可能吗?我之前解释过我之前的计划,但是有没有更简单的方法?
【问题讨论】:
标签: javascript node.js discord.js