mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
revert: support for nested arrays of components, fix error handling (#6081)
This commit is contained in:
@@ -53,11 +53,10 @@ class BaseMessageComponent {
|
||||
* Constructs a MessageComponent based on the type of the incoming data
|
||||
* @param {MessageComponentOptions} data Data for a MessageComponent
|
||||
* @param {Client|WebhookClient} [client] Client constructing this component
|
||||
* @param {boolean} [skipValidation=false] Whether or not to validate the component type
|
||||
* @returns {?MessageComponent}
|
||||
* @private
|
||||
*/
|
||||
static create(data, client, skipValidation = false) {
|
||||
static create(data, client) {
|
||||
let component;
|
||||
let type = data.type;
|
||||
|
||||
@@ -66,7 +65,7 @@ class BaseMessageComponent {
|
||||
switch (type) {
|
||||
case MessageComponentTypes.ACTION_ROW: {
|
||||
const MessageActionRow = require('./MessageActionRow');
|
||||
component = new MessageActionRow(data);
|
||||
component = new MessageActionRow(data, client);
|
||||
break;
|
||||
}
|
||||
case MessageComponentTypes.BUTTON: {
|
||||
@@ -82,7 +81,7 @@ class BaseMessageComponent {
|
||||
default:
|
||||
if (client) {
|
||||
client.emit(Events.DEBUG, `[BaseMessageComponent] Received component with unknown type: ${data.type}`);
|
||||
} else if (!skipValidation) {
|
||||
} else {
|
||||
throw new TypeError('INVALID_TYPE', 'data.type', 'valid MessageComponentType');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user