Skip to content

matcool/coxinha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

41 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Coxinha

Basic command system for discord.js written in typescript

Sample bot in examples/

Example

const { Bot, Command, Argument } = require('coxinha');

// ! is the prefix
const bot = new Bot('!');

bot.on('ready', () => {
    console.log(`Logged in as ${bot.user.tag}!`);
});

bot.addCommand(new Command({
    name: 'ping',
    aliases: ['pong'],
    help: 'Sends "Pong!"',
    async func(ctx) {
        await ctx.send('Pong!');
    }
}));

bot.addCommand(new Command({
    name: 'say',
    help: 'Sends given message',
    args: [
        // Combined means it'll be multiple words
        new Argument('message', {combined: true})
    ],
    async func(ctx, msg) {
        await ctx.send(msg);
    }
}));

bot.login('token');