New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

discord-c

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-c

[![MIT License](https://img.shields.io/npm/l/discord-c)]() [![Coverage](https://img.shields.io/badge/coverage-90%25-green)](https://opensource.org/licenses/) [![Version](https://img.shields.io/npm/v/discord-c?color=green&label=discord-c)]()

latest
npmnpm
Version
2.1.10
Version published
Maintainers
1
Created
Source

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

    InstanceFunctionsDescription
    botonmessageOn message call your callback
    botcomamndOn commands call your callback
    botstartStarts bot
  • All ctx functions

    ParameterObjectDescription
    ctxchannel FunctionSend message in channel
    ctxauthor.mentionMention author of message
    ctxauthor.mentionMention author of message
    ctxauthor.idId author of message
    ctxauthor.avatarAvatar author of message

Download

FAQs

Package last updated on 28 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts