这是我的代码,但我不知道将“ const embed = new Discord.RichEmbed()”行放在哪里。
const Discord = require("discord.js");
module.exports = {
name: "events",
description: "Display the events!",
execute(message, bot, args){
message.channel.sendEmbed(embed);
const embed = new Discord.RichEmbed()
.setTitle("Event Times")
.setDescription("Server's timezone: UTC+3")
.setThumbnail("https://i.imgur.com/Jk5Wxj3.png")
.addFields(
{ name: '\u200B', value: '\u200B' },
{ name: 'Monday', value: 'DemaNeR - Start 8AM' }, // Value is the event name and time.
{ name: 'Tuesday', value: 'Spaceball - Start 6PM' }, // value: 'new value'
{ name: 'Wednesday', value: 'JPB- Start 10PM' },
{ name: 'Thursday', value: 'Invasion - Start 9PM' },
{ name: 'Friday', value: 'Hitac - Start 4PM' },
{ name: 'Saturday', value: 'CVC(Infiltration) - All Day' },
{ name: 'Sunday', value: 'JPB - Start 7PM ->> Invasion - Start 10PM' },
)
.setColor("#f36639")
}
}
答案 0 :(得分:0)
在定义embed
之前,您要引用它。
execute(message, bot, args) {
const embed = new Discord.RichEmbed()
/* code omitted for brevity */
message.channel.sendEmbed(embed);
}
答案 1 :(得分:0)
只需切换这两行
message.channel.sendEmbed(embed);
const embed = new Discord.RichEmbed()
成为
const embed = new Discord.RichEmbed();
message.channel.sendEmbed(embed);