Reputation: 51
First I'd like to point out that I just started learning discord.js a month ago, so my code is probably all wrong and I understand that.
I'm trying to learn how to write embeds, but a whole ton of stuff doesn't work, mainly because I don't know where to put everything.
In my main js file, I have the following:
} else if (command == 'embed') {
client.commands.get('embed').execute(message, args);
}
And in my embed.js file, I have all of this code which doesn't work at all.
module.exports = {
name: 'embed',
description: 'example embed.',
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/wSTFkRM.png')
.addFields({
name: 'Regular field title',
value: 'Some value here'
}, {
name: '\u200B',
value: '\u200B'
}, {
name: 'Inline field title',
value: 'Some value here',
inline: true
}, {
name: 'Inline field title',
value: 'Some value here',
inline: true
}, )
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/wSTFkRM.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');
channel.send(exampleEmbed);
}
Thank you for listening to this. I'd love for anyone to help.
Upvotes: 0
Views: 527
Reputation: 6625
You are trying to export a MessageEmbed
in the module.exports
, but you need to export a function called execute
.
module.exports = {
name: 'embed',
description: 'example embed.',
execute: (message, args) => {
const exampleEmbed = new Discord.MessageEmbed()
.setColor('#0099ff')
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor('Some name', 'https://i.imgur.com/wSTFkRM.png', 'https://discord.js.org')
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/wSTFkRM.png')
.addFields({
name: 'Regular field title',
value: 'Some value here'
}, {
name: '\u200B',
value: '\u200B'
}, {
name: 'Inline field title',
value: 'Some value here',
inline: true
}, {
name: 'Inline field title',
value: 'Some value here',
inline: true
}, )
.addField('Inline field title', 'Some value here', true)
.setImage('https://i.imgur.com/wSTFkRM.png')
.setTimestamp()
.setFooter('Some footer text here', 'https://i.imgur.com/wSTFkRM.png');
message.channel.send(exampleEmbed);
}
}
Upvotes: 2