A Guide to Discord Bots

Embeds

Embeds are a really cool feature that only bots can use.
You probably already have seen it and might have wondered how to do it.

There's a really cool Embed Visualizer, useful for designing embeds.
They even support Markdown!

To get the color: Type 'color picker' into google or get another hexadecimal color picker. Convert it to decimal using any website, such as RapidTables.com.

client.on('message', (message) => {

    let color = 7081235; // hex: #6C0D13

    // The old school way
    message.channel.send({
        embed: {
            color: color, // Yes, variables will work
            title: '**Hello world!**',
            description: 'Markdown _for the win_!',
            author: {
                name: message.author.tag,
                icon_url: message.author.displayAvatarURL
            },
            timestamp: message.createdAt,
        }
    });


    // The simpler way
    let embed = new Discord.RichEmbed({
        title: '**Hello World**',
        description: 'Markdown _for the win_!'
    });

    embed.setColor(color);
    embed.setTimestamp(message.createdAt);
    embed.setAuthor(message.author.tag, message.author.displayAvatarURL);
});

RichEmbed on the discord.js documentation.

results matching ""

    No results matching ""