mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
refactor: Use deprecate() directly (#9026)
* refactor: just call `deprecate()` * docs: prevent crash * refactor: back to prototype deprecation
This commit is contained in:
@@ -23,16 +23,16 @@ class ActionRow extends Component {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new action row builder from JSON data
|
* Creates a new action row builder from JSON data
|
||||||
|
* @method from
|
||||||
|
* @memberof ActionRow
|
||||||
* @param {JSONEncodable<APIActionRowComponent>|APIActionRowComponent} other The other data
|
* @param {JSONEncodable<APIActionRowComponent>|APIActionRowComponent} other The other data
|
||||||
* @returns {ActionRowBuilder}
|
* @returns {ActionRowBuilder}
|
||||||
* @deprecated Use {@link ActionRowBuilder.from} instead.
|
* @deprecated Use {@link ActionRowBuilder.from} instead.
|
||||||
*/
|
*/
|
||||||
static from(other) {
|
static from = deprecate(
|
||||||
if (isJSONEncodable(other)) {
|
other => new this(isJSONEncodable(other) ? other.toJSON() : other),
|
||||||
return new this(other.toJSON());
|
'ActionRow.from() is deprecated. Use ActionRowBuilder.from() instead.',
|
||||||
}
|
);
|
||||||
return new this(other);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the API-compatible JSON for this component
|
* Returns the API-compatible JSON for this component
|
||||||
@@ -43,6 +43,4 @@ class ActionRow extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionRow.from = deprecate(ActionRow.from, 'ActionRow.from() is deprecated. Use ActionRowBuilder.from() instead.');
|
|
||||||
|
|
||||||
module.exports = ActionRow;
|
module.exports = ActionRow;
|
||||||
|
|||||||
@@ -270,11 +270,9 @@ class BaseInteraction extends Base {
|
|||||||
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.Button;
|
return this.type === InteractionType.MessageComponent && this.componentType === ComponentType.Button;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Get rid of this in the next major
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether this interaction is a {@link StringSelectMenuInteraction}.
|
* Indicates whether this interaction is a {@link StringSelectMenuInteraction}.
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*
|
|
||||||
* @deprecated Use {@link BaseInteraction#isStringSelectMenu} instead.
|
* @deprecated Use {@link BaseInteraction#isStringSelectMenu} instead.
|
||||||
*/
|
*/
|
||||||
isSelectMenu() {
|
isSelectMenu() {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class SelectMenuBuilder extends StringSelectMenuBuilder {
|
|||||||
|
|
||||||
if (!deprecationEmitted) {
|
if (!deprecationEmitted) {
|
||||||
process.emitWarning(
|
process.emitWarning(
|
||||||
'The SelectMenuBuilder class is deprecated, use StringSelectMenuBuilder instead.',
|
'The SelectMenuBuilder class is deprecated. Use StringSelectMenuBuilder instead.',
|
||||||
'DeprecationWarning',
|
'DeprecationWarning',
|
||||||
);
|
);
|
||||||
deprecationEmitted = true;
|
deprecationEmitted = true;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class SelectMenuComponent extends StringSelectMenuComponent {
|
|||||||
|
|
||||||
if (!deprecationEmitted) {
|
if (!deprecationEmitted) {
|
||||||
process.emitWarning(
|
process.emitWarning(
|
||||||
'The SelectMenuComponent class is deprecated, use StringSelectMenuComponent instead.',
|
'The SelectMenuComponent class is deprecated. Use StringSelectMenuComponent instead.',
|
||||||
'DeprecationWarning',
|
'DeprecationWarning',
|
||||||
);
|
);
|
||||||
deprecationEmitted = true;
|
deprecationEmitted = true;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class SelectMenuInteraction extends StringSelectMenuInteraction {
|
|||||||
|
|
||||||
if (!deprecationEmitted) {
|
if (!deprecationEmitted) {
|
||||||
process.emitWarning(
|
process.emitWarning(
|
||||||
'The SelectMenuInteraction class is deprecated, use StringSelectMenuInteraction instead.',
|
'The SelectMenuInteraction class is deprecated. Use StringSelectMenuInteraction instead.',
|
||||||
'DeprecationWarning',
|
'DeprecationWarning',
|
||||||
);
|
);
|
||||||
deprecationEmitted = true;
|
deprecationEmitted = true;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class SelectMenuOptionBuilder extends StringSelectMenuOptionBuilder {
|
|||||||
|
|
||||||
if (!deprecationEmitted) {
|
if (!deprecationEmitted) {
|
||||||
process.emitWarning(
|
process.emitWarning(
|
||||||
'The SelectMenuOptionBuilder class is deprecated, use StringSelectMenuOptionBuilder instead.',
|
'The SelectMenuOptionBuilder class is deprecated. Use StringSelectMenuOptionBuilder instead.',
|
||||||
'DeprecationWarning',
|
'DeprecationWarning',
|
||||||
);
|
);
|
||||||
deprecationEmitted = true;
|
deprecationEmitted = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user