UNPKG

cordlr-kontrolla

Version:
56 lines (47 loc) 1.71 kB
const CordlrPlugin = require('cordlr-plugin') class KontrollaPlugin extends CordlrPlugin { constructor (bot, config) { super(bot, config) // Set Meta Data of your Plugin to make it readable by Cordlr loaders and help plugins this.name = 'Kontrolla' this.description = 'Bot controller for changing bot avatar, username, game and status' // Define commands this.commands = { 'botname': { 'usage': '<newBotName>', 'function': 'changeBotName', 'description': 'Changes the bots username', 'permissions': ['ADMINISTRATOR', 'MANAGE_GUILD'] }, 'botgame': { 'usage': '<newBotGame>', 'function': 'changeBotGame', 'description': 'Changes the bots game', 'permissions': ['ADMINISTRATOR', 'MANAGE_GUILD'] } } } changeBotName (message, args, flags) { if (!args[0]) { this.sendInfo(message, 'Bot name is missing', 'Change Bot Name', this.embedFooter('Kontrolla Cordlr Plugin'), 'error') return false } this.botChangeUsername(args[0]) .then(() => { this.sendPrivateReply(message, 'You will call me ' + args[0] + ' from now on!') }) .catch(console.error) } changeBotGame (message, args, flags) { if (!args[0]) { this.sendInfo(message, 'Game title is missing', 'Change Bot Game', this.embedFooter('Kontrolla Cordlr Plugin'), 'error') return false } this.botChangeGame(args[0]) .then(() => { this.sendPrivateReply(message, 'Hey thanks! I am playing ' + args[0] + ' now!') }) .catch(console.error) } } module.exports = KontrollaPlugin