#Command Problem

1 messages · Page 1 of 1 (latest)

proper mica
#

So, that is my init function js async init() { this.on("ready", async () => { const CommandsArray = await this.registry.registerCommands() as CommandType[]; const EventsArray = await this.registry.registerEvents(); try { if (process.platform === "linux") { await this.application.commands.set(CommandsArray).then((commands) => { console.log("[COMMANDS] ".green + `Initialized (${commands.size}) global slash commands.`.white) }).catch((err) => { console.log("[COMMANDS] ".red + "Error while trying to initialize slash commands.".white, err); process.exit(0); }); } else { await this.guild.commands.set(CommandsArray).then((commands) => { console.log("[COMMANDS] ".green + `Initialized (${commands.size}) local slash commands.`.white); }).catch((err) => { console.log("[COMMANDS] ".red + "Error while trying to initialize slash commands.".white, err); process.exit(0); }); }; } catch (err) { console.log("[COMMANDS] ".red + "Error while trying to initialize slash commands.".white, err); }; console.log("[EVENTS] ".green + `Initialized (${EventsArray.length}) events.`.white); }); this.on("interactionCreate", async (int) => { console.log(int) if (!int.isCommand()) return; this.runCommand(int as IncognitoInteraction); }); this.login(process.platform === "linux" ? this.config.token.live : this.config.token.dev).then(() => { console.log("[LOGIN] ".green + this.user.username.white); }).catch((e) => { console.log("[LOGIN] ".red + "Error while trying to login.".white, e); process.exit(0); }); return this; };

red remnant
#

And the ready event logs correctly?

proper mica
#

Yes

red remnant
#

And are you executing the command from the right bot?

proper mica
#

Yeah sure

#

Well, I moved the command init out of the ready event and now it works 🤔