// plugins/basic.js - Example plugin with basic commands module.exports = { // Plugin initialization init(bot) { console.log('Basic plugin initialized'); this.bot = bot; }, // Plugin cleanup (called when reloading/unloading) cleanup(bot) { console.log('Basic plugin cleaned up'); }, // Event handlers onMessage(data, bot) { // This gets called for every message // You can add custom logic here if (data.message.includes('hello') && data.message.includes(bot.config.nick)) { bot.say(data.replyTo, `Hello ${data.nick}!`); } }, // Commands that this plugin provides commands: [ { name: 'ping', description: 'Responds with pong', execute(context, bot) { bot.say(context.replyTo, `${context.nick}: pong!`); } }, { name: 'echo', description: 'Echoes back the message', execute(context, bot) { if (context.args.length === 0) { bot.say(context.replyTo, `${context.nick}: Please provide a message to echo`); return; } const message = context.args.join(' '); bot.say(context.replyTo, `${context.nick}: ${message}`); } }, { name: 'help', description: 'Shows available commands', execute(context, bot) { const commands = Array.from(bot.commands.keys()); bot.say(context.replyTo, `Available commands: ${commands.join(', ')}`); } }, { name: 'reload', description: 'Reloads all plugins (admin only)', execute(context, bot) { // Simple admin check (you can make this more sophisticated) const adminNicks = ['admin', 'owner']; // Add your admin nicks here if (!adminNicks.includes(context.nick)) { bot.say(context.replyTo, `${context.nick}: Access denied`); return; } bot.reloadAllPlugins(); bot.say(context.replyTo, `${context.nick}: Plugins reloaded`); } } ] };