feat(MessageEmbed): re-introduce MessageEmbed#addField (#3850)

* feat(MessageEmbed): re-introduce MessageEmbed#addField

* suggestion: sorting alphabetically

* suggestion: document inline to default false for #addField
This commit is contained in:
Souji
2020-02-28 17:58:52 +01:00
committed by GitHub
parent 261816dcf8
commit df88729c44
2 changed files with 13 additions and 1 deletions

View File

@@ -215,6 +215,17 @@ class MessageEmbed {
(this.footer ? this.footer.text.length : 0));
}
/**
* Adds a field to the embed (max 25).
* @param {StringResolvable} name The name of this field
* @param {StringResolvable} value The value of this field
* @param {boolean} [inline=false] If this field will be displayed inline
* @returns {MessageEmbed}
*/
addField(name, value, inline) {
return this.addFields({ name, value, inline });
}
/**
* Adds fields to the embed (max 25).
* @param {...EmbedFieldData|EmbedFieldData[]} fields The fields to add
@@ -391,7 +402,7 @@ class MessageEmbed {
* @typedef {Object} EmbedFieldData
* @property {StringResolvable} name The name of this field
* @property {StringResolvable} value The value of this field
* @property {boolean} [inline] If this field will be displayed inline
* @property {boolean} [inline=false] If this field will be displayed inline
*/
/**

1
typings/index.d.ts vendored
View File

@@ -1053,6 +1053,7 @@ declare module 'discord.js' {
public type: string;
public url?: string;
public readonly video: MessageEmbedVideo | null;
public addField(name: StringResolvable, value: StringResolvable, inline?: boolean): this;
public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
public attachFiles(file: (MessageAttachment | FileOptions | string)[]): this;
public setAuthor(name: StringResolvable, iconURL?: string, url?: string): this;