Socket
Socket
Sign inDemoInstall

discord-bot-lib

Package Overview
Dependencies
4
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    discord-bot-lib

A basic discord bot library for node.js but the library doesn't cache discord objects.


Version published
Weekly downloads
0
Maintainers
1
Created
Weekly downloads
 

Readme

Source

discord-bot-lib

A basic discord bot lib for node.js but the library doesn't cache discord objects.

Installation

$ npm install discord-bot-lib

Key points

  • Simple command handler.
  • Simple handler for slash commands.
  • This lib does NOT cache external discord objects.
  • This lib does NOT support voice (sorry music bots)
  • This lib gives you full control on how you cache discord data.
  • This lib gives you full control on how you handle discord gateway events.
  • Really customizable.

Simple Bot Example

// require the lib
const Client = require('discord-bot-lib');

// create the client
const bot = new Client({
    token: "Discord Token",
    prefix: "/"
});

bot.addEventListener('ready', data => {
    console.log(`The bot is ready! Serving ${data.guilds.length} guilds.`);
});

bot.addEventListener('error', async (ctx, err) => {
    await ctx.send(`Whoopsies! The bot did an oopsie woopsie!\n\`${err}\``);
});

bot.addEventListener('close', () => console.log("Goodbye, world! :c"));

// simple command handler example
bot.command({
    name: "ping",
    aliases: ["pong"],
    run: async (ctx) => {
        return await ctx.send('Pong');
    }
});

// run the bot
bot.run();

Keywords

FAQs

Last updated on 10 Jul 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc