2.1.10 • Published 3 years ago

discord-c v2.1.10

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

discord-c

MIT License Coverage Version

A simple package to create bots in discord

Description

discord-c is a very simple bot creation API, if you want something very simple, like just responding to messages or commands, this API is for you

Basic starts

const { Bot } = require('discord-c');

const bot = new Bot();

bot.onmessage((ctx) => {
    ctx.channel.send(ctx.author.mention, 'Hi');
});

bot.command('ping', (ctx) => {
    ctx.channel.send('PONG!');
});

bot.start('token', () => {
    console.log('started');
});

Commands

  • Basic

    Default prefix is $

    bot.command('ping', (ctx) => {
        ctx.channel.send('PONG!');
    });
    
    bot.command('hi', (ctx) => {
        ctx.channel.send('Hello .-.');
    });
  • Module commands

    const { Bot } = require('discord-c');
    
    const com = new Bot.Commands();
    
    com.command('ping', (ctx) => {
        ctx.channel.send('PONG!');
    });
    
    com.command('hi', (ctx) => {
        ctx.channel.send('Hello .-.');
    });
    
    module.exports = bot;

    In other file

    const { Bot } = require('discord-c');
    const commands = require('./commands');
    
    const bot = new Bot();
    
    bot.commandsUse(commands);

Reference

  • Basic functions | Instance | Functions | Description | | :-------- | :------- | :------------------------- | | bot | onmessage | On message call your callback | | bot | comamnd | On commands call your callback | | bot | start | Starts bot |

  • All ctx functions | Parameter | Object | Description | | :-------- | :------- | :------------------------- | | ctx | channel Function | Send message in channel | | ctx | author.mention | Mention author of message | | ctx | author.mention | Mention author of message | | ctx | author.id | Id author of message | | ctx | author.avatar | Avatar author of message |

Download

2.1.2

3 years ago

2.1.1

3 years ago

2.1.4

3 years ago

2.1.5

3 years ago

2.1.8

3 years ago

2.1.7

3 years ago

2.1.0

3 years ago

2.1.9

3 years ago

2.1.10

3 years ago

1.1.0

3 years ago

1.2.42

3 years ago

1.2.32

3 years ago

1.2.28

3 years ago

1.2.24

3 years ago

1.2.22

3 years ago

1.2.20

3 years ago

1.2.11

3 years ago

1.2.10

3 years ago

1.2.9

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.1.3

3 years ago

1.0.2

3 years ago