mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +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
|
||||
* @method from
|
||||
* @memberof ActionRow
|
||||
* @param {JSONEncodable<APIActionRowComponent>|APIActionRowComponent} other The other data
|
||||
* @returns {ActionRowBuilder}
|
||||
* @deprecated Use {@link ActionRowBuilder.from} instead.
|
||||
*/
|
||||
static from(other) {
|
||||
if (isJSONEncodable(other)) {
|
||||
return new this(other.toJSON());
|
||||
}
|
||||
return new this(other);
|
||||
}
|
||||
static from = deprecate(
|
||||
other => new this(isJSONEncodable(other) ? other.toJSON() : other),
|
||||
'ActionRow.from() is deprecated. Use ActionRowBuilder.from() instead.',
|
||||
);
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
@@ -270,11 +270,9 @@ class BaseInteraction extends Base {
|
||||
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}.
|
||||
* @returns {boolean}
|
||||
*
|
||||
* @deprecated Use {@link BaseInteraction#isStringSelectMenu} instead.
|
||||
*/
|
||||
isSelectMenu() {
|
||||
|
||||
@@ -15,7 +15,7 @@ class SelectMenuBuilder extends StringSelectMenuBuilder {
|
||||
|
||||
if (!deprecationEmitted) {
|
||||
process.emitWarning(
|
||||
'The SelectMenuBuilder class is deprecated, use StringSelectMenuBuilder instead.',
|
||||
'The SelectMenuBuilder class is deprecated. Use StringSelectMenuBuilder instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
deprecationEmitted = true;
|
||||
|
||||
@@ -15,7 +15,7 @@ class SelectMenuComponent extends StringSelectMenuComponent {
|
||||
|
||||
if (!deprecationEmitted) {
|
||||
process.emitWarning(
|
||||
'The SelectMenuComponent class is deprecated, use StringSelectMenuComponent instead.',
|
||||
'The SelectMenuComponent class is deprecated. Use StringSelectMenuComponent instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
deprecationEmitted = true;
|
||||
|
||||
@@ -15,7 +15,7 @@ class SelectMenuInteraction extends StringSelectMenuInteraction {
|
||||
|
||||
if (!deprecationEmitted) {
|
||||
process.emitWarning(
|
||||
'The SelectMenuInteraction class is deprecated, use StringSelectMenuInteraction instead.',
|
||||
'The SelectMenuInteraction class is deprecated. Use StringSelectMenuInteraction instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
deprecationEmitted = true;
|
||||
|
||||
@@ -15,7 +15,7 @@ class SelectMenuOptionBuilder extends StringSelectMenuOptionBuilder {
|
||||
|
||||
if (!deprecationEmitted) {
|
||||
process.emitWarning(
|
||||
'The SelectMenuOptionBuilder class is deprecated, use StringSelectMenuOptionBuilder instead.',
|
||||
'The SelectMenuOptionBuilder class is deprecated. Use StringSelectMenuOptionBuilder instead.',
|
||||
'DeprecationWarning',
|
||||
);
|
||||
deprecationEmitted = true;
|
||||
|
||||
Reference in New Issue
Block a user