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 :: js remove several elements from array 
Javascript :: javascript linting 
Javascript :: math question 
Javascript :: delete div based on select 
Javascript :: javascript regex get domain from url 
Javascript :: express delete session variable 
Javascript :: Detect Mobile / Computer by Javascript 
Javascript :: swap first and last element in array javascript 
Javascript :: p5js right mouse button released 
Javascript :: module parse failed: unexpected character ' (1:0) you may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. see https://webpack.js.org/concepts#loaders 
Javascript :: node biology definition 
Javascript :: javascript closest child 
Javascript :: is js dead 
Javascript :: declaring variable react hooks 
Javascript :: display form input on console jquery 
Javascript :: loop number in react 
Python :: months list python 
Python :: jupyter display all columns 
Python :: get yesterday date python 
Python :: numpy array remove scientific notation 
Python :: how to open any program on python 
Python :: Python pandas drop any column 
Python :: python reload lib jupyter notebook %reload 
Python :: install spotipy 
Python :: how to change pygame window icon 
Python :: colab save figure 
Python :: how to print hostname in python 
Python :: django admin create superuser 
Python :: convert list of strings to ints python 
Python :: loop through list backwards python 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =