Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(MessageEmbed): add setFields method #6186

Merged
merged 3 commits into from
Jul 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/structures/MessageEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ class MessageEmbed {
return this;
}

/**
* Sets the embed's fields (max 25).
* @param {...EmbedFieldData|EmbedFieldData[]} fields The fields to set
* @returns {MessageEmbed}
*/
setFields(...fields) {
this.spliceFields(0, this.fields.length, fields);
return this;
}

/**
* Sets the author of this embed.
* @param {string} name The name of the author
Expand Down
1 change: 1 addition & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ export class MessageEmbed {
public readonly video: MessageEmbedVideo | null;
public addField(name: string, value: string, inline?: boolean): this;
public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
public setFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
public setAuthor(name: string, iconURL?: string, url?: string): this;
public setColor(color: ColorResolvable): this;
public setDescription(description: string): this;
Expand Down