npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@botbind/nebula

v0.0.4-beta

Published

A lifecycle based Discord framework, completely modular and customisable!

Downloads

3

Readme

Nebula 🌌👾

A lifeycle based Discord bot framework, influenced by ReactJS, completely customisable and modular!

What? Another discord bot framework? 😕

Yes, we know. Another framework. New things to learn yet new experiences as well. Unlike other bot frameworks like klasa or discord.js-commando, we focus on how to keep the framework as minimal as possible, yet still give the developers better abilities to create their dream bots.

Right from the start, our team has planned on ways to minimalise other frameworks' features while still leverage those at the same time. Nebula is heavily influenced by React's lifecycle concepts, which in short terms mean methods that can be fired at different stages in a bot's life. A typical command might look like:

const { Command } = require('@botbind/nebula');

module.exports = class MyCommand extends Command {
  constructor(client) {
    super(client, {
      name: 'my-command',
      alias: ['my-alias'],
    });
  }

  didDispatch(message) {
    message.channel.send('Hi, it works!');
  }
};

Wait!!! Before we move on, what's up with the name?

Nebula is the earliest stage of a star, a collection of dust and gases. We believe that your imaginations are just like those little particles in the universe, when put together correctly, with the right aid and support, they're gonna shine and excel!

But I'm not convinced. Give me more features please! 😔

Addons 🔨🔧

Our framework leverages the idea of addons. They are small pieces of 'app', ranging from one silly command to a full-blown music module. Completely compatible with our botbind hosting service.

Ease of argument validation and parsing ❌✔️❌❌

klasa leverages usage string to allow developers to define their own arguments. One caveat is that it's hard to read and maintain. We, on the other hand, implemented a more intuitive way that uses arrays to validate arguments, making code maintenance a piece of cake.

Completely customisable ✏️ 📏✂️

Less doesn't mean worse in this case. Your addon can still be yours. Want a more dynamic way to validating arguments? Just extend the Validator class and you will have the full power. Want the messages to be parsed in your way? Just implement Addon.parseCommands(). Honestly, there are so many things you can do, and we don't want to limit your imagination.

Strongly typed ☑️

Our code, unlike other frameworks, are written entirely in Typescript, allowing easier Typescript usage and safe code. Feel free to try it out!

Sounds good, show me some code please! 💘

Here you go

// index.js
const { Client, Addon } = require('@botbind/nebula');

class MyClient extends Client {
  ready() {
    this.user.setActivity("Hello, I'm ready");
  }
}

class MyAddon extends Addon {
  constructor(client) {
    super(client, {
      name: 'test-addon',
      baseDir: __dirname,
      folderName: {
        commands: 'command',
        tasks: 'scheduledTasks',
      },
    });
  }
}

const client = new MyClient({ debug: true });

client.load(MyAddon).login(/* your token */);

// commands/SayHi.js
const Discord = require('discord.js');
const { Command } = require('@botbind/nebula');

module.exports = class SayHi extends Command {
  constructor(client) {
    super(client, {
      name: 'test',
      alias: ['t'],
      schema: [Validator.any],
    });
  }

  async didDispatch(message, [name]) {
    message.channel.send(`Hi, ${name}`);
  }
};

Ah ha, looks pretty clean doesn't it? For Typescripters:

// index.ts
const { Client, Addon } = require('@botbind/nebula');

class MyClient extends Client {
  ready() {
    this.user.setActivity("Hello, I'm ready");
  }
}

class MyAddon extends Addon {
  constructor(client: Client) {
    super(client, {
      name: 'test-addon',
      baseDir: __dirname,
      folderName: {
        commands: 'command',
        tasks: 'scheduledTasks',
      },
    });
  }
}

const client = new MyClient({ debug: true });

client.load(MyAddon).login(/* your token */);

// commands/SayHi.ts
const Discord = require('discord.js');
const { Command, Client } = require('@botbind/nebula');

module.exports = class SayHi extends Command {
  constructor(client: Client) {
    super(client, {
      name: 'test',
      alias: ['t'],
      schema: [Validator.any],
    });
  }

  async didDispatch(message: Discord.Message, [name]: string[]) {
    message.channel.send(`Hi, ${name}`);
  }
};