user8571487
user8571487

Reputation: 1

How do i make my Embed work?

I need help with my embed Could someone check over this for me? I cant find the problem and it won't tell me what the problem is.

const discord = require("discord.js");

const TOKEN = "PRIVATE TOKEN";
const PREFIX = "-("

var bot = new discord.client();

bot.on("message", function(message) {
    if (message.author.equals(bot.user)) return;

    if (!message.content.startsWith(PREFIX)) return;

    var args = message.content.substring(PREFIX.length).split(" ")

    switch (args[0].toLowerCase()) {
        case "embed":
            var embed = new discord.RichEmbed()
                .setDescription("Hello, This is an Awesome ");
            message.channel.sendEmbed(embed);
            break;
        default:
            message.channel.sendMessage("Invalid Command!")
    }
});

bot.login(TOKEN);

Upvotes: 0

Views: 2193

Answers (2)

TheThirdDimension
TheThirdDimension

Reputation: 311

If you need help with embeds, look here for a full explanation on how to use both regular and RichEmbeds from AnIdiotsGuide.

https://anidiots.guide/examples/using-embeds-in-messages.html

Upvotes: 1

Plutonus Commissions
Plutonus Commissions

Reputation: 41

It's just as easy to send a message with the embed inside of it, rather than using RichEmbed (for me anyway).


Using Embeds Without RichEmbed

message.channel.send({embed: {
    title: "Hello!",
    description: "this is an awesome embed!"
}});

^ This is what that looks like! ^

You may also find this handy little tool useful, it lets you see a live version of your Embed before you copy it over to your bot, meaning a lot less testing and fixing.

Again though, I haven't used RichEmbed, but this is a more-than-easy compromise.

Upvotes: 1

Related Questions