Events
Erine allows you to handle every client event with ease.
Handling events
You can declare events in your main file by doing
const { Erine } = require('erine');
const bot = new Erine({
intents: Array<string>
owners: Array<string>
prefix: string | asyncFunction
});
bot.on(event_name, function(...args) { /* Code here. */ });
bot.login(string);
or using the load method
const { Erine } = require('erine');
const bot = new Erine({
intents: Array<string>
owners: Array<string>
prefix: string | asyncFunction
});
bot.load(path_to_files);
bot.login(string);
You must know...
<client>
parameter is enforced for every event function (when using load_events method), examples:
Message Create
const event = {
name: 'messageCreate',
async code(client, message) {
// More logic here.
}
}
module.exports = { data: event }
Guild Member Add
const event = {
name: 'guildMemberAdd',
async code(client, member) {
// More logic here.
}
}
module.exports = { data: event }