parent
aecc7edec5
commit
a3f8f9f0fa
@ -6,8 +6,9 @@ const Util = require('../util/Util');
|
|||||||
|
|
||||||
let deprecationEmittedForSetAuthor = false;
|
let deprecationEmittedForSetAuthor = false;
|
||||||
let deprecationEmittedForSetFooter = false;
|
let deprecationEmittedForSetFooter = false;
|
||||||
|
let deprecationEmittedForAddField = false;
|
||||||
|
|
||||||
// TODO: Remove the deprecated code for `setAuthor()` and `setFooter()`.
|
// TODO: Remove the deprecated code for `setAuthor()`, `setFooter()` and `addField()`.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
* Represents an embed in a message (image/video preview, rich embed, etc.)
|
||||||
@ -314,8 +315,18 @@ class MessageEmbed {
|
|||||||
* @param {string} value The value of this field
|
* @param {string} value The value of this field
|
||||||
* @param {boolean} [inline=false] If this field will be displayed inline
|
* @param {boolean} [inline=false] If this field will be displayed inline
|
||||||
* @returns {MessageEmbed}
|
* @returns {MessageEmbed}
|
||||||
|
* @deprecated This method is a wrapper for {@link MessageEmbed#addFields}. Use that instead.
|
||||||
*/
|
*/
|
||||||
addField(name, value, inline) {
|
addField(name, value, inline) {
|
||||||
|
if (!deprecationEmittedForAddField) {
|
||||||
|
process.emitWarning(
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
'MessageEmbed#addField is deprecated and will be removed in the next major update. Use MessageEmbed#addFields instead.',
|
||||||
|
'DeprecationWarning',
|
||||||
|
);
|
||||||
|
|
||||||
|
deprecationEmittedForAddField = true;
|
||||||
|
}
|
||||||
return this.addFields({ name, value, inline });
|
return this.addFields({ name, value, inline });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@ -2035,6 +2035,7 @@ export class MessageEmbed {
|
|||||||
public type: string;
|
public type: string;
|
||||||
public url: string | null;
|
public url: string | null;
|
||||||
public readonly video: MessageEmbedVideo | null;
|
public readonly video: MessageEmbedVideo | null;
|
||||||
|
/** @deprecated This method is a wrapper for {@link MessageEmbed#addFields}. Use that instead. */
|
||||||
public addField(name: string, value: string, inline?: boolean): this;
|
public addField(name: string, value: string, inline?: boolean): this;
|
||||||
public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
|
public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
|
||||||
public setFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
|
public setFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
|
||||||
|
Loading…
Reference in New Issue
Block a user