Enable automatic command registration and fix event listener for bot startup

Adjusted bot.js to use the 'ready' event instead of 'clientReady' and implemented automatic slash command registration upon startup.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 217d5b68-1b40-4732-95b4-1137cb7d5086
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/BBAQobO
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
sirpiglr 2025-12-08 03:03:14 +00:00
parent 844f8d266f
commit 90436b6c4e
2 changed files with 10 additions and 6 deletions

View file

@ -22,10 +22,6 @@ externalPort = 80
localPort = 8080
externalPort = 8080
[[ports]]
localPort = 37193
externalPort = 3000
[workflows]
runButton = "Project"

View file

@ -881,10 +881,18 @@ client.login(token).catch((error) => {
process.exit(1);
});
client.once("clientReady", () => {
client.once("ready", async () => {
console.log(`Bot logged in as ${client.user.tag}`);
console.log(`Watching ${client.guilds.cache.size} server(s)`);
console.log("Commands are registered via: npm run register-commands");
// Auto-register commands on startup
console.log("Registering slash commands with Discord...");
const regResult = await registerDiscordCommands();
if (regResult.success) {
console.log(`Successfully registered ${regResult.count} commands`);
} else {
console.error("Failed to register commands:", regResult.error);
}
client.user.setActivity("Protecting the Federation", { type: 3 });