This package has been deprecated
Author message:
Don't need
@vnbot/toolkit
1.0.4 • Public • Published
EZBOT-TOOLKIT - WRITE PLUGIN EASIER
How to use ?
npm i --save @vnbot/toolkit
const { Plugin, InfoMessage, Joi } = require('@vnbot/toolkit');
const schema = Joi.object({
prefix: Joi.string().default('!'),
name: Joi.string().default('Easy Bot'),
admins: Joi.array().items(Joi.string().required()).default(['100009859624773']),
}).unknown();
const pluginInfo = Plugin.getPluginInfo(__dirname);
module.exports = class CustomBot extends Plugin {
constructor(options) {
super(pluginInfo); // plugin config
const valid = schema.validate(options);
if (valid.error) throw valid.error;
this.options = valid.value;
}
active(bot) {
super.active(bot);
bot.setOptions({
bot: this.options,
});
bot.emit('info', new InfoMessage('Prefix: ' + this.options.prefix));
}
};
const { Bot } = require('@vnbot/ezbot');
const bot = new Bot({
email: 'email',
password: 'password',
});
const Plugin = require('PATH_TO_MODULE');
bot.on('info', (msg) => msg && msg.log && msg.log());
bot.once('error', (err) => {
bot.stop();
});
bot.register(new Plugin({ prefix: '!' }));
bot.start();
Package Sidebar
Install
Weekly Downloads