From c25cfac8ee093c484ad26a5c848795b93a4ecd49 Mon Sep 17 00:00:00 2001 From: Shadow Date: Sun, 22 Sep 2024 20:50:05 -0500 Subject: [PATCH] fix: make embed data not required to create embed class --- .changeset/dirty-tips-flash.md | 5 +++++ packages/carbon/src/classes/Embed.ts | 24 +++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 .changeset/dirty-tips-flash.md diff --git a/.changeset/dirty-tips-flash.md b/.changeset/dirty-tips-flash.md new file mode 100644 index 00000000..c6c1acfb --- /dev/null +++ b/.changeset/dirty-tips-flash.md @@ -0,0 +1,5 @@ +--- +"@buape/carbon": patch +--- + +fix: make embed data not required to create embed class diff --git a/packages/carbon/src/classes/Embed.ts b/packages/carbon/src/classes/Embed.ts index 0f0c75b2..68418714 100644 --- a/packages/carbon/src/classes/Embed.ts +++ b/packages/carbon/src/classes/Embed.ts @@ -61,17 +61,19 @@ export class Embed { /** * Create an embed from an API embed */ - constructor(embed: APIEmbed) { - this.title = embed.title - this.description = embed.description - this.url = embed.url - this.timestamp = embed.timestamp - this.color = embed.color - this.footer = embed.footer - this.image = embed.image?.url - this.thumbnail = embed.thumbnail?.url - this.author = embed.author - this.fields = embed.fields + constructor(embed?: APIEmbed) { + if (embed) { + this.title = embed.title + this.description = embed.description + this.url = embed.url + this.timestamp = embed.timestamp + this.color = embed.color + this.footer = embed.footer + this.image = embed.image?.url + this.thumbnail = embed.thumbnail?.url + this.author = embed.author + this.fields = embed.fields + } } /**