This commit is contained in:
Lukian 2023-06-20 15:28:07 +02:00
parent 68f4b60012
commit 41ae7ff4bd
1010 changed files with 38622 additions and 17071 deletions

View file

@ -1,6 +1,7 @@
'use strict';
const { ButtonBuilder: BuildersButton, isJSONEncodable } = require('@discordjs/builders');
const { ButtonBuilder: BuildersButton } = require('@discordjs/builders');
const { isJSONEncodable } = require('@discordjs/util');
const { toSnakeCase } = require('../util/Transformers');
const { resolvePartialEmoji } = require('../util/Util');
@ -27,14 +28,11 @@ class ButtonBuilder extends BuildersButton {
/**
* Creates a new button builder from JSON data
* @param {JSONEncodable<APIButtonComponent>|APIButtonComponent} other The other data
* @param {ButtonBuilder|ButtonComponent|APIButtonComponent} other The other data
* @returns {ButtonBuilder}
*/
static from(other) {
if (isJSONEncodable(other)) {
return new this(other.toJSON());
}
return new this(other);
return new this(isJSONEncodable(other) ? other.toJSON() : other);
}
}
@ -42,5 +40,5 @@ module.exports = ButtonBuilder;
/**
* @external BuildersButton
* @see {@link https://discord.js.org/#/docs/builders/main/class/ButtonBuilder}
* @see {@link https://discord.js.org/docs/packages/builders/stable/ButtonBuilder:Class}
*/