Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to create a discord.js embed

//Note: For discord.js version 14
const { EmbedBuilder } = require('discord.js');

const exampleEmbed = new EmbedBuilder()
	.setColor(0x0099FF)
	.setTitle('Some title')
	.setURL('https://discord.js.org/')
	.setAuthor({ name: 'Some name', iconURL: 'https://i.imgur.com/AfFp7pu.png', url: 'https://discord.js.org' })
	.setDescription('Some description here')
	.setThumbnail('https://i.imgur.com/AfFp7pu.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 },
	)
	.addFields({ name: 'Inline field title', value: 'Some value here', inline: true })
	.setImage('https://i.imgur.com/AfFp7pu.png')
	.setTimestamp()
	.setFooter({ text: 'Some footer text here', iconURL: 'https://i.imgur.com/AfFp7pu.png' });

channel.send({ embeds: [exampleEmbed] });
Comment

Embed Example Discord.js

const embed = new Discord.RichEmbed() //Ver 11.5.1 of Discord.js
.setTitle("This is a title")
.setTitle("http://tryitands.ee")
.setDescription("This is a description")
.setTimestamp()
.setFooter("This is a footer")
.setAuthor("This is the author's name", //and this its profile pic)
.addField("This is a field", "this is its description")
.setImage("https://cdn.discordapp.com/avatars/449250687868469258/1709ab4f567c56eaa731518ff621747c.png?size=2048")
.setThumbnail("https://cdn.discordapp.com/avatars/449250687868469258/1709ab4f567c56eaa731518ff621747c.png?size=2048")
<message>.<channel>.send(embed)
Comment

discord.js embed

/*
 			 Need more help? Add me on discord: Dwagon#0069
             				Discord.js ^13.8.1
*/

// The embed itself
const embed = new MessageEmbed()
	.setTitle("Title")
	.setURL("https://www.codegrepper.com/") // The redirected URL when clicking on the title
	.setDescription("Description") 
	.addField("Title of field", "Description of field", true) // When adding ", true" you enable the inline.
	// or
    .addFields(
      { name: "Title of field", value: "Description of field"}, // Inline disabled
      { name: "Title of field", value: "Description of field", inline: true} // Inline enabled
      )
	.setAuthor({ name: "Main title", iconURL: "https://i.imgur.com/2LUu1KL.png", url: "https://www.codegrepper.com/"})
	.setImage("https://i.imgur.com/2LUu1KL.png")
	.setThumbnail("https://i.imgur.com/2LUu1KL.png")
	.setTimestamp()
	.setFooter({
      text: "Main title", iconURL: "https://i.imgur.com/2LUu1KL.png"
    })
	.setColor("00FF00");

// Send to channel with interaction
interaction.channel.send({ embeds: [embed] });

// Send to channel with message
message.channel.send({ embeds: [embed] });
Comment

PREVIOUS NEXT
Code Example
Javascript :: is typescript faster than javascript 
Javascript :: javascript disable form 
Javascript :: javascript array find element by id 
Javascript :: deleting key of json object 
Javascript :: javascript if a variable is undefined 
Javascript :: react js onclick call two functions 
Javascript :: set label text in jquery 
Javascript :: typescript read json file 
Javascript :: how to remove an element javascript html 
Javascript :: javascript copy image to clipboard 
Javascript :: js sort by date 
Javascript :: ngswitchcase in angular 8 
Javascript :: fetch post headers 
Javascript :: react add inline styles in react 
Javascript :: js select by data attribute 
Javascript :: strapi change user password 
Javascript :: jquery table each rows with class 
Javascript :: allow only numbers and special characters in textbox using javascript 
Javascript :: default value input date js 
Javascript :: create function replace all n javescript 
Javascript :: joi object id validation 
Javascript :: jquery add event after page load 
Javascript :: jshint esversion: 6 
Javascript :: controlled autocomplete material ui 
Javascript :: accept Post with no midleWare express 
Javascript :: javascript open page 
Javascript :: js ternary 
Javascript :: import modules js html 
Javascript :: count json objects 
Javascript :: npm react pagination 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =