TypeError piace.aliases is not iterable

Good afternoon, I mixed such a strange code as best I could. My task was to add a button to the message with a built-in embed, but it's not clear why I get an error in the console, please give me an answer what I did wrong :). Code and error below. const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, } = require("@discordjs/builders") const { Command, Piece, InteractionHandlerTypes } = require('@sapphire/framework'); const { ButtonStyle, InteractionType } = require("discord.js"); class Embed extends Command { constructor(ctx, context, options) { super(ctx, context, { ...options, InteractionHandlerType: InteractionHandlerTypes.Button }); }
registerApplicationCommands(registry) { registry.registerChatInputCommand((builder) => builder.setName('rules').setDescription('description') ); } async chatInputRun(interaction,client) { const button = new ButtonBuilder() .setCustomId("rulesrp") .setLabel(label) .setStyle(ButtonStyle.Primary); const embed = new EmbedBuilder() .setTitle('title') .setDescription(descriptiom) .setTimestamp() const embed2 = new EmbedBuilder() .setTitle('title') .setDescription(desciption) .setTimestamp() const embed3 = new EmbedBuilder() .setTitle('title') .setDescription(description)

interaction.channel.send({ embeds: [embed,embed2,embed3]}, {components: [ActionRowBuilder(),addComponents(button)]}) } } module.exports = { Embed, ActionRowBuilder, ButtonBuilder } D:Файлы\Project 1\node_modules@sapphire\pieces\dist\lib\structures\AliasStore.js:58 for (const key of piece.aliases) { ^
Solution:
Good afternoon, I mixed such a strange code as best I could. My task was to add a button to the message with a built-in embed, but it's not clear why I get an error in the console, please give me an answer what I did wrong :). Code and error below. const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, } = require("@discordjs/builders") const { Command, Piece, InteractionHandlerTypes } = require('@sapphire/framework'); const { ButtonStyle, InteractionType } = require("discord.js");...
No description
F
Favna392d ago
Please use codeblocks: ```js const Discord = require("discord.js"); // further code ``` becomes
const Discord = require("discord.js");
// further code
const Discord = require("discord.js");
// further code
Inline Code: `console.log('inline!');` becomes console.log('inline!'); ------------------------
F
Favna392d ago
At any rate, this is a complete jumble of code. the error occurs when you try to construct a class in a folder that that class does not belong you extend class but then you specify InteractionHandlerType which doesn't exist on classes, suggesting you actually want to write an interaction handler. Read our user guide https://www.sapphirejs.dev
Sapphire Framework
Home | Sapphire
Sapphire is a next-gen Discord bot framework for developers of all skill levels to make the best JavaScript/TypeScript based bots possible.
F
Favna392d ago
also you have a typo here. You should really sanity read your own code a bit better.
A
Ararou392d ago
what am I even looking at im pretty sure that’s not how you extend command oh I spotted another one
A
Ararou392d ago
Want results from more Discord servers?
Add your server
More Posts
I'm getting this error when used my new precondtion.my fileAPIInteractionDataResolvedGuildMember does not have idWhile fetching for member using `interaction.options.getMember('member')` it gives two types - `GuilAPI Client with SSL?Hey guys, currently I am trying to make the switch from an custom express API to the API plugin. IsContext Menu Command and Subcommand cannot be in same extended class?I have a slash command which is an extended `Subcommand` called `give-role` with two subcommands - `UserErrors not being caught by listener - bot is crashingmessageCommandError.mjs ```js import { Events, Listener } from "@sapphire/framework"; import { send Subcommand isn't runningWhen the subcommand is run in Discord, it times out. I've added a log to the beginning of the methodHow to properly handle UserErrors?I'm using the official sapphire template and want to throw a UserError inside a context menu commandCan I set different requiredUserPermissions for each subcommand?Just wondering if this is possible, and how. ThanksHandling BulkOverwrite Registry ErrorsWhen I encounter this error ``` [ERROR] ApplicationCommandRegistries(BulkOverwrite) Failed to overwrEvents for VoiceHow can I do something like the following but for voice? ``` import { Listener } from '@sapphire/frHow do I use autocompleteRun on subcommands?^ As the title says. I can't seem to figure out how subcommands can have autocompleteRun implementedMessage editing fails even though message can be fetchedWhenever I want to edit an ephemeral message I get the following error: ```js [ERROR] Encountered erProblem with ephemeral messagesI currently have a command which sends a button, problem is, once the button is pressed, I can't remIs recommend have split autocomplete handlersI want know is recommend have split handler such as characterAutocomplete & itemsAutocomplete.Error serverHow can I solve this error ? ``` Error [ERR_SERVER_ALREADY_LISTEN]: Listen method has been called mQuick question regarding application descriptionsHow does one link an application command in the description of an app? Looks like a mention syntax, What typescript version to use?Since the most recent announcement in #Announcements recommends that I should not use typescript verHow to get subcommand name from interaction object?I ~~am~~ will be having multiple commands which have their own sub commands (3 sub command per parenHow do I listen for reactions on all messages in a channel?doing discord bot dev after a long time. i wanted to listen for message reactions on every message iMessageCreate Event isn't workingThis is the first listener Im creating I've read the documentation 50 times imo and checked out the