Aghanim
Aghanim is a Command Client created by Desvelao^^ for create bots with Eris in NodeJS based on Yuuko
Version: v0.1.0
Using the package
Aghanim's core is only available at Github repository. It extends Eris and is basically an alternative to its CommandClient class.
Installation
$ yarn add Desvelao/aghanim#dev # yarn
$ npm install --save Desvelao/aghanim#dev # npm
Steps
- Create a bot instance
- Define your Categories
- Add Commands/Subcommands
- Add Components
- Add Command Requirements
Example
//index.js
const Aghanim = require('aghanim');
const { Command, Component } = require('aghanim');
const client = new Aghanim(
'your_bot_token', // Token used to auth your bot account
{
prefix: 'a!' // Prefix used to trigger commands
}
);
client.addCategory('Fun', 'Fun commands');
const pingCommand = new Command(
'ping',
{
category: 'Fun',
help: 'Get Pong!',
args: ''
},
async function (msg, args, client, command) {
msg.channel.createMessage('Pong!');
}
);
client.addCommand(pingCommand);
// Component:
class MyComponent extends Component {
constructor(client, options) {
super(client); // this.client is Aghanim Client instance. You can use in other methods
}
ready(client) {
// method fired in client.on('ready', handler) by default of this component. Each component can add handlers for events.
console.log('My component is ready');
}
messageCreate(msg, args, client, command) {
// method fired in client.on('messageCreate', handler).
console.log(`Message: ${msg.content}`);
// this.client is Aghanim Client instance. You can use it here
}
}
client.addComponent(MyComponent);
// Bot connent
client.connect();
$ node index.js