Giter Site home page Giter Site logo

Discord-Rose

The simple Discord library for advanced users.

Installation

Run npm i --save discord-rose

Links

Wiki Docs

Support Server

NPM, GitHub

Simple bot

You can easily use the SingleWorker class for easy use of discord-rose, for scaled solution, look below

./index.js

const { SingleWorker } = require('discord-rose')

const worker = new SingleWorker({
  token: 'BOT TOKEN'
})

worker.commands
  .prefix('!')
  .add({
    command: 'hello',
    exec: (ctx) => {
      ctx.reply('World!')
    }
  })

Scaled Bot

You can instead use a Master & Worker solution, one master managing multiple workers/clusters, which hold x amount of shards, making it much more efficient.

./master.js

const { Master } = require('discord-rose')
const path = require('path')

const master = new Master(path.resolve(__dirname, './worker.js'), {
  token: 'BOT TOKEN'
})

master.start()

./worker.js

const { Worker } = require('discord-rose')

const worker = new Worker()

worker.commands
  .prefix('!')
  .add({
    command: 'hello',
    exec: (ctx) => {
      ctx.reply('World!')
    }
  })

Do node ./master.js and you're off to the races. Scaled automatically.

Do note if your bot only ever fits into 1 cluster (< 5000 servers by default), you should consider using SingleWorker since master & worker introduce more process overhead

You can even easily implement slash commands directly within message commands.

Ready to take it to the next level? Take a look out our Wiki

discord-rose's Projects

embed icon embed

Simple embed renderer with easy callbacks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.