© 2026 Hedgehog Software, LLC
//messageCreate.js require('dotenv').config(); module.exports = { name: 'messageCreate', execute(message, client){ const prefix = process.env.PREFIX; console.log('Message') if(!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).split(/ +/); const cmd = args.shift().toLowerCase(); const command = client.commands.get(cmd) || client.commands.find(a => a.aliases && a.aliases.includes(cmd)); if(command) command.execute(client, message, args); } }
client.events = new Collection
//inside index.js const eventsPath = path.join(__dirname, 'Events'); const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js')); for (const file of eventFiles) { const event_filePath = path.join(eventsPath, file); const event = require(event_filePath); if (event.once) { client.once(event.name, (...args) => event.execute(...args)); } else { client.on(event.name, (...args) => event.execute(...args)); } }