diff --git a/src/builders/Embed.ts b/src/builders/Embed.ts index f3430ad..86911d0 100644 --- a/src/builders/Embed.ts +++ b/src/builders/Embed.ts @@ -30,8 +30,8 @@ export class Embed { * @example * embed.setAuthor({ name: 'John Doe', iconURL: 'https://example.com/avatar.png' }); */ - setAuthor(author: ObjectToLower): this { - this.data.author = toSnakeCase(author); + setAuthor(author?: ObjectToLower): this { + this.data.author = author && toSnakeCase(author); return this; } @@ -43,8 +43,8 @@ export class Embed { * embed.setColor('#FF0000'); * embed.setColor('Blurple'); */ - setColor(color: ColorResolvable): this { - this.data.color = resolveColor(color); + setColor(color?: ColorResolvable): this { + this.data.color = color && resolveColor(color); return this; } @@ -55,7 +55,7 @@ export class Embed { * @example * embed.setDescription('This is the description of the embed'); */ - setDescription(desc: string): this { + setDescription(desc?: string): this { this.data.description = desc; return this; } @@ -79,8 +79,8 @@ export class Embed { * @example * embed.setFields([{ name: 'Field 1', value: 'Value 1' }, { name: 'Field 2', value: 'Value 2' }]); */ - setFields(fields: APIEmbedField[]): this { - this.data.fields = fields; + setFields(fields?: APIEmbedField[]): this { + this.data.fields = fields ?? []; return this; } @@ -91,8 +91,8 @@ export class Embed { * @example * embed.setFooter({ text: 'This is the footer', iconURL: 'https://example.com/footer.png' }); */ - setFooter(footer: ObjectToLower>): this { - this.data.footer = toSnakeCase(footer); + setFooter(footer?: ObjectToLower>): this { + this.data.footer = footer && toSnakeCase(footer); return this; } @@ -103,8 +103,8 @@ export class Embed { * @example * embed.setImage('https://example.com/image.png'); */ - setImage(url: string): this { - this.data.image = { url }; + setImage(url?: string): this { + this.data.image = url ? { url } : undefined; return this; } @@ -129,7 +129,7 @@ export class Embed { * @example * embed.setTitle('This is the title'); */ - setTitle(title: string): this { + setTitle(title?: string): this { this.data.title = title; return this; } @@ -141,7 +141,7 @@ export class Embed { * @example * embed.setURL('https://seyfert.com'); */ - setURL(url: string): this { + setURL(url?: string): this { this.data.url = url; return this; }