Event-driven architecture — React to Discord and bot events
Backward compatibility — Legacy addons still work
Priority system — Control execution order of handlers
Error isolation — One addon's error won't crash others
Rich context — Access client, config, and language data
Async support — Full Promise / async-await support
🚀 Quick Start
Example: HelloWorld Addon
A simple addon that responds to messages, welcomes new members, and reacts to tickets being created:
hello-world-addon.js
module.exports={ // Only 'name' is required!name:'HelloWorld', // Everything else is optional (but recommended for clarity) // version: '1.0.0' // description: '...' // author: 'Your Name'events:{ // Respond to messages'discord:messageCreate':async(eventData,context)=>{const{message}=eventData;if (message.author.bot) return;if (message.content.toLowerCase() ==='!hello') {awaitmessage.channel.send(`Hello ${message.author.username}! 👋`);}}, // Welcome new members'discord:guildMemberAdd':async(eventData,context)=>{const{member}=eventData;console.log(`New member joined: ${member.user.username}`);constchannel=member.guild.channels.cache.find(ch=>ch.name==='welcome'||ch.name==='general' );if (channel) {awaitchannel.send(`Welcome ${member.user.username}! 🎉`);}}, // React to tickets being created'ticket:created':async(eventData,context)=>{const{ticket,user}=eventData;console.log(`Ticket #${ticket.ticketId} was created by ${user.username}`);}}};
✅ With this addon
Type !hello → Bot replies with a greeting
New members join → Welcome message in #welcome or #general
Ticket is created → Logged in console
📡 Event Reference
Discord Events
Listen to Discord.js events with the discord: prefix:
discord:messageCreate — New message sent (key data: message)
{
client: Client, // Discord.js client
config: Object, // Bot config
lang: Object, // Language config
eventName: String, // Current event
timestamp: Date, // Emitted at
guild: Guild|null, // Guild if available
user: User|null // User if available
}
'discord:messageCreate': async (eventData, context) => {
const { message } = eventData;
// Only in specific channels
if (!['general', 'bot-commands'].includes(message.channel.name)) return;
// Only non-bots
if (message.author.bot) return;
// Your logic here
}