diff --git a/packages/discord.js/src/structures/ActionRowBuilder.js b/packages/discord.js/src/structures/ActionRowBuilder.js index 379b0e1f4327..eb5f27630a61 100644 --- a/packages/discord.js/src/structures/ActionRowBuilder.js +++ b/packages/discord.js/src/structures/ActionRowBuilder.js @@ -1,6 +1,6 @@ 'use strict'; -const { ActionRowBuilder: BuildersActionRow, ComponentBuilder, isJSONEncodable } = require('@discordjs/builders'); +const { ActionRowBuilder: BuildersActionRow, isJSONEncodable } = require('@discordjs/builders'); const { createComponentBuilder } = require('../util/Components'); const { toSnakeCase } = require('../util/Transformers'); @@ -12,7 +12,7 @@ class ActionRowBuilder extends BuildersActionRow { constructor({ components, ...data } = {}) { super({ ...toSnakeCase(data), - components: components?.map(c => (c instanceof ComponentBuilder ? c : createComponentBuilder(c))), + components: components?.map(c => createComponentBuilder(c)), }); } diff --git a/packages/discord.js/src/util/Components.js b/packages/discord.js/src/util/Components.js index ca3f02ccae24..07032c089cb3 100644 --- a/packages/discord.js/src/util/Components.js +++ b/packages/discord.js/src/util/Components.js @@ -87,7 +87,7 @@ function createComponent(data) { case ComponentType.TextInput: return new TextInputComponent(data); default: - throw new Error(`Found unknown component type: ${data.type}`); + return new Component(data); } } @@ -111,7 +111,7 @@ function createComponentBuilder(data) { case ComponentType.TextInput: return new TextInputComponent(data); default: - throw new Error(`Found unknown component type: ${data.type}`); + return new ComponentBuilder(data); } }