mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
fix: embeds optional parameters (#281)
* fix: embeds optional parameters
This commit is contained in:
parent
ddb320c428
commit
4e6bf3b8bd
@ -30,8 +30,8 @@ export class Embed {
|
||||
* @example
|
||||
* embed.setAuthor({ name: 'John Doe', iconURL: 'https://example.com/avatar.png' });
|
||||
*/
|
||||
setAuthor(author: ObjectToLower<APIEmbedAuthor>): this {
|
||||
this.data.author = toSnakeCase(author);
|
||||
setAuthor(author?: ObjectToLower<APIEmbedAuthor>): 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<Omit<APIEmbedFooter, 'proxy_icon_url'>>): this {
|
||||
this.data.footer = toSnakeCase(footer);
|
||||
setFooter(footer?: ObjectToLower<Omit<APIEmbedFooter, 'proxy_icon_url'>>): 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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user