我想创建一个帮助屏幕,您可以使用反应滚动浏览。
例如
但是,我无法让我的机器人删除用户的反应,也无法让它编辑我的消息。
这是代码。提前感谢您的帮助!
client.on('message', message => {
if (message.author !== null && message.author.bot) return;
if (message.toString().startsWith(';help')) {
const helpPi = new Discord.MessageEmbed()
.setTitle('Help and commands')
.setColor('0004ff')
.setDescription('This is the help menu for available commands. Here is the table of contents:\n> 1 - Commands\n> 2 - More info.')
const helpP1 = new Discord.MessageEmbed()
.setTitle('Help and commands')
.setColor('0004ff')
.setDescription('Command A\nCommand B')
const helpP2 = new Discord.MessageEmbed()
.setTitle('Help and commands')
.setColor('0004ff')
.setDescription('More info.')
message.channel.send(helpPi).then(sentMessage => {
sentMessage.react('ℹ️')
sentMessage.react('1️⃣')
sentMessage.react('2️⃣')
client.on('messageReactionAdd', reaction => {
if (reaction == '1️⃣') {
sentMessage.edit(helpP1)
}
else if (reaction == '2️⃣') {
sentMessage.edit(helpP2)
}
else if (reaction == 'ℹ️') {
sentMessage.edit(helpPi)
}
})
})
}
});