thenorthsolution / Reciple

⚡Discord.js framework that just works
https://reciple.js.org
GNU General Public License v3.0
12 stars 1 forks source link

Loading in 0 Slash Commands - Reciple Update - "reciple": "^7.9.9"` -> `"reciple": "^7.9.10" #34

Closed boushrabettir closed 1 year ago

boushrabettir commented 1 year ago

According to the documentation, I have set up the proper things needed to make the slash commands work. However, after updating Reciple, it is no longer registering the slash commands.

I am expecting it might have been with this update, updating from "reciple": "^7.9.9" -> "reciple": "^7.9.10"

Terminal

[19:44:40 WARN] Logged in as Register#0186 (1158594033489281104)
[19:44:40 INFO] Loaded 0 context menu command(s)
[19:44:40 INFO] Loaded 0 message command(s)
[19:44:40 INFO] Loaded 0 slash command(s)

Program

import { RecipleModuleScript, SlashCommandBuilder } from 'reciple';
import { EmbedBuilder } from "discord.js";
import { chooseResponse } from './Utils/Text.js';
import { Interact } from './Events/Interact.js';
import { setEnvVariable, retrieveData, setClassType, setClassName} from './Utils/Utils.js';
import { Error } from './Utils/ErrorHandling.js';

export default {
    versions: ['^7'], 
    commands:  [

        new SlashCommandBuilder()
            .setName("add-type")
            .setDescription("Set your class type.")
            .addStringOption(option => 
                option.setName("type")
                .setDescription("The course type. E.g. 'cpsc'")
                .setRequired(true)
                )
            .setExecute(async ({interaction, client}) => {
                const { options, user } = interaction;

                setEnvVariable();

                let botImbedMessage: EmbedBuilder = new EmbedBuilder();

                const COURSE_TYPE = options.getString("type");
                const PROFESSOR_TOKEN = process.env.PROFESSOR_TOKEN?.toString();

                const member = await interaction.guild?.members.fetch(user);

                if (COURSE_TYPE && PROFESSOR_TOKEN && member?.roles.cache.has(PROFESSOR_TOKEN)) {

                    setClassType(COURSE_TYPE);

                    botImbedMessage = new EmbedBuilder()
                    .setAuthor({name: `${interaction.user.username}, you've successfully added the course type!`})
                    .setDescription(`You added the course type: **${COURSE_TYPE?.toUpperCase()}**`)
                    .setColor(0x0099FF)
                    .setTimestamp();

                } else {
                    botImbedMessage = new EmbedBuilder()
                    .setAuthor({name: `${interaction.user.username}, you're not an admin!`})
                    .setDescription(new Error().incorrectRole())
                    .setColor(0xCC0000)
                    .setTimestamp();         
                }

                await interaction.reply({ content: `<@${user.id}>`, embeds: [botImbedMessage]});   
            }),

       // Many more slash commands...
      ]

    // Module resolved logic here (Bot not logged in)
    onStart(client) {
        return true;
    },

    // Module loaded logic here (Bot logged in)
    onLoad(client, module_) {},

    // Unload logic here
    onUnload({ reason, client }) {}
} satisfies RecipleModuleScript;
catplvsplus commented 1 year ago

The update didn't change anything related about loading modules & commands. Perhaps you had something changed in your code before or after updating (eg. your config)? Also, if you're using typescript try building the source before running the bot.