feat(bot): add NodeJS implementation and deploy script

This commit is contained in:
2025-04-23 21:40:02 +08:00
parent 5c632556b7
commit 74dfdbf667
12 changed files with 704 additions and 0 deletions

31
src/events/ready.js Normal file
View File

@@ -0,0 +1,31 @@
const { Events } = require('discord.js');
const logger = require('../utils/logger');
const loadErelaEvents = require('../structures/ErelaEvents'); // Import the Erela event loader
module.exports = {
name: Events.ClientReady,
once: true, // This event should only run once
execute(client) {
logger.info(`Ready! Logged in as ${client.user.tag}`);
// Initialize the Erela Manager once the client is ready
try {
client.manager.init(client.user.id);
logger.info(`Erela.js Manager initialized for user ID: ${client.user.id}`);
// Load Erela.js event handlers
loadErelaEvents(client);
} catch (error) {
logger.error(`Failed to initialize Erela.js Manager: ${error.message}`);
// Depending on requirements, you might want to exit or handle this differently
}
// Placeholder for setting activity, etc.
// client.user.setActivity('Music!', { type: 'LISTENING' });
// Note: Slash command registration is typically done in a separate deploy script,
// not usually within the ready event for production bots.
// We will create a deploy-commands.js script later.
},
};