mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
Fix embed init data object reference (#274)
* fix: avoid embed use initial object ref * chore: use spread operator instead
This commit is contained in:
parent
2912296d96
commit
27d2fa000c
@ -11,14 +11,16 @@ import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter } from '..
|
|||||||
* const embedJSON = embed.json();
|
* const embedJSON = embed.json();
|
||||||
*/
|
*/
|
||||||
export class Embed {
|
export class Embed {
|
||||||
|
public data: Partial<APIEmbed>;
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of Embed.
|
* Creates a new instance of Embed.
|
||||||
* @param data - The initial data for the embed.
|
* @param data - The initial data for the embed.
|
||||||
* @example
|
* @example
|
||||||
* const embed = new Embed({ title: 'Hello', description: 'This is an example embed' });
|
* const embed = new Embed({ title: 'Hello', description: 'This is an example embed' });
|
||||||
*/
|
*/
|
||||||
constructor(public data: Partial<APIEmbed> = {}) {
|
constructor(data: Partial<APIEmbed> = {}) {
|
||||||
if (!data.fields) this.data.fields = [];
|
this.data = { ...data };
|
||||||
|
if (!this.data.fields) this.data.fields = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user