@jadl/builders
Version:
Builders for JaDL
98 lines (97 loc) • 2.81 kB
TypeScript
import type { APIEmbed } from 'discord-api-types/v9';
import Colors from '../utils/colors';
/**
* Discord Embed
*/
export declare class Embed {
obj: APIEmbed;
static default: Embed;
constructor(obj?: APIEmbed);
/**
* Sets the color
* @param color Color hex code
*/
color(color: keyof typeof Colors | number): this;
/**
* Sets author
* @param name Name of author
* @param icon Author avatar icon
* @param url URL anchored to the author name
*/
author(name: string, icon?: string, url?: string): this;
/**
* Sets the title
* @param title Title name
* @param url URL anchored to title name
*/
title(title?: string, url?: string): this;
/**
* Sets description
* @param desc Description
*/
description(desc: string): this;
/**
* Adds a field
* @param name Fields title
* @param value Fields value
* @param inline Whether the field is inline
*/
field(name: string, value: string, inline?: boolean): this;
/**
* Sets the thumbnail
* @param url URL of thumbnail
* @param width Optional fixed width
* @param height Optional fixed height
*/
thumbnail(url: string, width?: number, height?: number): this;
/**
* Sets the image
* @param url URL of image
* @param width Optional fixed width
* @param height Optional fixed height
*/
image(url: string, width?: number, height?: number): this;
/**
* Sets the video
* @param url URL of video
* @param width Optional fixed width
* @param height Optional fixed height
*/
video(url: string, width?: number, height?: number): this;
/**
* Sets the footer
* @param text Text for footer
* @param icon Small icon on the bottom left
*/
footer(text?: string, icon?: string): this;
/**
* Sets the timestamp
* @param date Date to set, leave blank for current time
*/
timestamp(date?: Date): this;
clone(): Embed;
static LIMITS: {
TITLE_LENGTH: number;
DESCRIPTION_LENGTH: number;
FIELD_NAME_LENGTH: number;
FIELD_VALUE_LENGTH: number;
FOOTER_TEXT_LENGTH: number;
AUTHOR_NAME_LENGTH: number;
TOTAL_LENGTH: number;
FIELDS: number;
};
/**
* Total length of the embed of combined character elements (should not exceed 6000)
*/
get length(): number;
/**
* Tests the embeds values for exceeded limits
* @returns Whether or not a part of the embed exceeds it's limits
*/
exceedsLimits(): boolean;
/**
* Renders the embed
* @returns
*/
render(): APIEmbed;
}