commit
This commit is contained in:
parent
a15c733e45
commit
2a5130cbda
2838 changed files with 288613 additions and 0 deletions
36
node_modules/discord.js/src/structures/ModalBuilder.js
generated
vendored
Normal file
36
node_modules/discord.js/src/structures/ModalBuilder.js
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
'use strict';
|
||||
|
||||
const { ModalBuilder: BuildersModal, ComponentBuilder, isJSONEncodable } = require('@discordjs/builders');
|
||||
const { toSnakeCase } = require('../util/Transformers');
|
||||
|
||||
/**
|
||||
* Represents a modal builder.
|
||||
* @extends {BuildersModal}
|
||||
*/
|
||||
class ModalBuilder extends BuildersModal {
|
||||
constructor({ components, ...data } = {}) {
|
||||
super({
|
||||
...toSnakeCase(data),
|
||||
components: components?.map(c => (c instanceof ComponentBuilder ? c : toSnakeCase(c))),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new modal builder from JSON data
|
||||
* @param {JSONEncodable<APIModalComponent>|APIModalComponent} other The other data
|
||||
* @returns {ModalBuilder}
|
||||
*/
|
||||
static from(other) {
|
||||
if (isJSONEncodable(other)) {
|
||||
return new this(other.toJSON());
|
||||
}
|
||||
return new this(other);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ModalBuilder;
|
||||
|
||||
/**
|
||||
* @external BuildersModal
|
||||
* @see {@link https://discord.js.org/#/docs/builders/main/class/ModalBuilder}
|
||||
*/
|
Loading…
Add table
Add a link
Reference in a new issue