Sapphire - Imagine a framework
Sapphire - Imagine a framework


Root Question Message

piece.aliases is not iterable

Hi everybody, I was just coding a simple bot, it has only a few, basic commands like ping-pong. I just keep getting this error, and I can't figure out where it comes out from. I got it first when I created a class which extends InteractionHandler, and now even by removing that class I keep getting it.
Any help is welcome.

This is the class I am talking about. Don't know if I'm missing something or doing something wrong.
import {Awaitable, InteractionHandler, InteractionHandlerTypes, Listener, Option} from "@sapphire/framework";
import {ButtonInteraction} from "discord.js";
import Context = Listener.Context;
import {prisma} from "../db/db.js";

export default class ShowTeacherInteraction extends InteractionHandler {
    public constructor(ctx: Context, options: InteractionHandler.Options) {
        super(ctx, {
            interactionHandlerType: InteractionHandlerTypes.Button,

    parse(_interaction: ButtonInteraction): Awaitable<Option<any>> {
        if (!"show-teacher-")) return this.none();

        return this.some('-')[2]);

    public async run(interaction: ButtonInteraction, teacher_id: number) {
        const teacher = await prisma.teacher.findUnique({
            where: {
                id: teacher_id

        if (!teacher || teacher.guild_id != interaction.guildId) {
            await interaction.reply("Teacher not found!");

        await interaction.reply({content: teacher.full_name, ephemeral: true});

Solution Message

You put the InteractionHandler in the commands folder. It should go in the interaction-handlers folder instead.
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy