mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 22:11:53 +00:00
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:
parent
261816dcf8
commit
df88729c44
2 changed files with 13 additions and 1 deletions
|
|
@ -215,6 +215,17 @@ class MessageEmbed {
|
||||||
(this.footer ? this.footer.text.length : 0));
|
(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).
|
* Adds fields to the embed (max 25).
|
||||||
* @param {...EmbedFieldData|EmbedFieldData[]} fields The fields to add
|
* @param {...EmbedFieldData|EmbedFieldData[]} fields The fields to add
|
||||||
|
|
@ -391,7 +402,7 @@ class MessageEmbed {
|
||||||
* @typedef {Object} EmbedFieldData
|
* @typedef {Object} EmbedFieldData
|
||||||
* @property {StringResolvable} name The name of this field
|
* @property {StringResolvable} name The name of this field
|
||||||
* @property {StringResolvable} value The value 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
1
typings/index.d.ts
vendored
|
|
@ -1053,6 +1053,7 @@ declare module 'discord.js' {
|
||||||
public type: string;
|
public type: string;
|
||||||
public url?: string;
|
public url?: string;
|
||||||
public readonly video: MessageEmbedVideo | null;
|
public readonly video: MessageEmbedVideo | null;
|
||||||
|
public addField(name: StringResolvable, value: StringResolvable, inline?: boolean): this;
|
||||||
public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
|
public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
|
||||||
public attachFiles(file: (MessageAttachment | FileOptions | string)[]): this;
|
public attachFiles(file: (MessageAttachment | FileOptions | string)[]): this;
|
||||||
public setAuthor(name: StringResolvable, iconURL?: string, url?: string): this;
|
public setAuthor(name: StringResolvable, iconURL?: string, url?: string): this;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue