【发布时间】:2021-06-12 02:32:22
【问题描述】:
我想知道如何做到这一点,如果有人对特定的表情符号做出反应,机器人会发送另一条消息。这是一个帮助命令。我自己完成了命令,机器人对他自己的消息做出反应,我还为其他消息添加了嵌入,我只是不知道如何让它工作。
这是我的代码:
const { DiscordAPIError } = require("discord.js");
const Discord = require('discord.js');
const client = new Discord.Client();
module.exports = {
name: 'help',
description: "Overview of all commands!",
execute(message, args) {
const embed = new Discord.MessageEmbed()
.setColor("#171b20")
.setTitle("Help")
.setDescription("React to the message to see commands of a specific category!")
.addFields({
name: ":red_square:" + " Moderation",
value: '\u200b'
}, {
name: ":orange_square:" + " Interaction",
value: '\u200b'
}, {
name: ":yellow_square:" + " Fun",
value: '\u200b'
}, {
name: ":purple_square:" + " Games",
value: '\u200b'
}, {
name: ":brown_square:" + " NSFW",
value: '\u200b'
}, {
name: ":green_square:" + " Information",
value: '\u200b'
})
.setFooter(message.author.username)
.setTimestamp();
message.channel.send(embed).then(embedMsg => {
embedMsg.react("????")
.then(reaction => embedMsg.react('????'))
.then(reaction => embedMsg.react('????'))
.then(reaction => embedMsg.react('????'))
.then(reaction => embedMsg.react('????'))
.then(reaction => embedMsg.react('????'))
})
const moderation = new Discord.MessageEmbed()
.setColor("#ff0000")
.setTitle("Help")
.setDescription("Below you can see the moderation commands.")
.addFields({
name: "test",
value: "this is a test"
})
.setFooter(message.author.username)
.setTimestamp();
const interaction = new Discord.MessageEmbed()
.setColor("#ffa500")
.setTitle("Help")
.setDescription("Below you can see the interaction commands.")
.addFields({
name: "test",
value: "this is a test"
})
.setFooter(message.author.username)
.setTimestamp();
const fun = new Discord.MessageEmbed()
.setColor("#ffff00")
.setTitle("Help")
.setDescription("Below you can see the fun commands.")
.addFields({
name: "test",
value: "this is a test"
})
.setFooter(message.author.username)
.setTimestamp();
const games = new Discord.MessageEmbed()
.setColor("#e600e6")
.setTitle("Help")
.setDescription("Below you can see the games commands.")
.addFields({
name: "test",
value: "this is a test"
})
.setFooter(message.author.username)
.setTimestamp();
const nsfw = new Discord.MessageEmbed()
.setColor("#4d0000")
.setTitle("Help")
.setDescription("Below you can see the nsfw commands.")
.addFields({
name: "test",
value: "this is a test"
})
.setFooter(message.author.username)
.setTimestamp();
const information = new Discord.MessageEmbed()
.setColor("#008000")
.setTitle("Help")
.setDescription("Below you can see the information commands.")
.addFields({
name: "test",
value: "this is a test"
})
.setFooter(message.author.username)
.setTimestamp();
}
}
【问题讨论】:
标签: javascript node.js discord discord.js bots