7777.0.9 • Published 4 years ago
discord.js-carlo v7777.0.9
discord.js-carlo
Discord.js BOT Framework
Features
- Custom command handler
- Custom Logger Console logging ERRORS PASSES WARNINGS Built in Discord chat logging DM GROUP SERVER
Example
index.js
const Carlo = require('./index');
const carlo = new Carlo({
commands: __dirname + '/commands/', //Path to commands folder
token: '', // BOT token
prefix: '!', // BOT prefix
logChat: true // Built in chat logging
});
const client = carlo._getClient(); // _getClient() is the same as Discord.Client()
const logger = carlo._getLogger(); // get custom logger
client.on('message', message => {
logger.pass(`this is a success`);
logger.error(`this is an erorr`);
logger.warn(`this is a warning`);
});
Command Example
/commands/ping.js
class PingCommand {
constructor() {
this.name = 'ping', // command name
this.alias = [''], // alias
this.usage = '!ping' // usage/description
}
async run(client, message, args) {
try {
//do code
message.channel.send(`${client.ping}ms`);
} catch(error) { throw error; }
}
};
module.exports = PingCommand;