Skip to content

Commit

Permalink
fix: disable readonly properties for builder
Browse files Browse the repository at this point in the history
  • Loading branch information
SocketSomeone committed May 30, 2024
1 parent 6cf0d4e commit 1d5a870
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/helpers/page-builder.helper.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { BaseMessageOptions as PageOptions } from 'discord.js';

type NotReadOnly<T> = {
-readonly [P in keyof T]: T[P];
};

export class PageBuilder {
private content: PageOptions['content'] = null;

private embeds: PageOptions['embeds'] = [];
private embeds: NotReadOnly<PageOptions['embeds']> = [];

private files: PageOptions['files'] = [];
private files: NotReadOnly<PageOptions['files']> = [];

private components: PageOptions['components'] = [];

Expand All @@ -14,22 +18,22 @@ export class PageBuilder {
return this;
}

public setEmbeds(embeds: PageOptions['embeds']): this {
public setEmbeds(embeds: PageBuilder['embeds']): this {
this.embeds = embeds;
return this;
}

public addEmbed(embed: PageOptions['embeds'][0]): this {
public addEmbed(embed: PageBuilder['embeds'][0]): this {
this.embeds.push(embed);
return this;
}

public setFiles(files: PageOptions['files']): this {
public setFiles(files: PageBuilder['files']): this {
this.files = files;
return this;
}

public addFile(file: PageOptions['files'][0]): this {
public addFile(file: PageBuilder['files'][0]): this {
this.files.push(file);
return this;
}
Expand Down

0 comments on commit 1d5a870

Please sign in to comment.