Skip to content
paige edited this page Aug 28, 2023 · 6 revisions

Embeds function similarly to how they do in Discord.JS except with a few adjustments to make things generally easier
For more info on embeds and how they're formatted check out this

Creating Embeds

Embeds are classes so they are created like this:

let embed = new wc.Embed({/* stuff */});

Now we'll go over the new additions for embeds

Embed Colors

wc has built in colors that you can use for embeds
If you want a full list of the colors you can look here

For this example let's say we want to make the embed color blurple

{
	// it can be any of these
	color: wc.colors.blurple
	color: "#7289da"
	color: 0x7289da
}

Embed Timestamps

wc also has built in times that you can use for embeds
You can either just make the timestamp value "now" or "current" or alternatively you can use wc.time and they should function the same.

{
	// it can be any of these
	timestamp: "now"
	timestamp: "current"
	timestamp: wc.time.now.embed
	timestamp: wc.time.set.embed(date)
}

Embed Structures

If you want more info on how embeds function this is the code:

Embed = class {
	constructor(obj) {
		if (obj.color) { obj.color = obj.color.colorFormat(); }
		if (obj.author) {
			if (obj.author.icon) { obj.author.icon_url = obj.author.icon; }
			else if (obj.author.iconURL) { obj.author.icon_url = obj.author.iconURL; }
		}
		if (typeof obj.thumbnail == "string") {
			let thumbnail = obj.thumbnail;
			obj.thumbnail = { url: thumbnail };
		}
		if (obj.fields) {
			let fixFields = [];
			
			obj.fields.forEach( (field) => {
				fixFields.push(field);
				if (field.newline) { fixFields.push({ name:"** **", value: "** **", inline: false}); }
			});

			obj.fields = fixFields;
		}
		if (typeof obj.image == "string") {
			let image = obj.image;
			obj.image = { url: image };
		}
		if (obj.timestamp) {
			if (obj.timestamp.toLowerCase() == "current" || obj.timestamp.toLowerCase() == "now") obj.timestamp = new Date().toISOString();
		}
		if (obj.footer) {
			if (typeof obj.footer == "string") {
				let footer = obj.footer;
				obj.footer = { text: footer };
			}
			
			if (obj.footer.name) { obj.footer.text = obj.footer.name; }
			if (obj.footer.icon) { obj.footer.icon_url = obj.footer.icon; }
			else if (obj.footer.iconURL) { obj.footer.icon_url = obj.footer.iconURL; }
		}
		
		return obj;
	}
}
Clone this wiki locally