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

kyuris

v0.1.2

Published

An Easy-To-Use Framework For The Eris Library

Downloads

23

Readme

Kyuris

Kyuris is a lightweight, easy-to-use framework built specially for the Eris library.

Example

  • Kyuris supports any kind of project structure since Kyuris is made to be customizable for developers to code in their own style ✨

Note: It's not needed setup messageCreate and ready events as Kyuris has already handle them in order to works.

An Example Of a Project Structure:


Discord-Bot/
├── Commands/
│   ├── General/
│   │   └── Ping.js
│
├── Events/
│   └── ShardPreReady.js/
│
└── index.js

index.js File:


const Kyuris = require("kyuris");

class ExampleBot extends Kyuris.Client {
    constructor() {

        /* Replace TOKEN with your bot's token */
        /* Pro Tips: KyurisOptions supports for Eris.ClientOptions as well! Thus, there'll be 2 different Client options at once */
        super("TOKEN", {
            prefix: "!",
            ownerID: [
                "YourID"
            ],
            maxShards: "auto"
        });

        /* Run the bot */
        this.run();

    }

}

module.exports = new ExampleBot();

That's it? Yes but no. We also need to setup a commands for your bot. Kyuris.Client has 2 parameters, token and KyurisOptions. We need to filled out token in order for the bot to connect to the Discord gateway and KyurisOptions as an optional things for the bot. prefix property inside the KyurisOptions is required for your bot to work. KyurisOptions is also an extended options for Eris.ClientOptions as shown above example. Now, let's move to the next step.

Commands/General/Ping.js File:


const Eris = require("eris");
const Kyuris = require("kyuris");

class PingCommand extends Kyuris.Command {

    constructor() {

        super();

        this.name = "ping"; // The command name
        this.aliases = ["p"]; // The command aliases. Must be an array of string
        this.cooldown = 3; // Cooldown must be in numbers (seconds)
        this.allowInDMs = true // Whether to allow users to execute the command in Private Channels/DMs

    }

    /**
     * @param {Kyuris.Client} client Extended Client for Eris.Client
     * @param {Eris.Message<Eris.TextableChannel>} message Eris message
     * @param {Array<String>} args Command's arguments
     */
    async run(client, message, args) {

        client.createMessage(message.channel.id, "Pong!");

    }

}

module.exports = new PingCommand();

This time, we're creating a command in a command file. You'll need to pass the name property for the command name and this is required. Any other properties are optional. To run the command, we're going to use a function called run. This method has 3 parameters. They are Kyuris.Client client (An extended Client of Eris.Client), Eris.Message message, and Array<String> args.

Events/ShardPreReady.js File:


const Kyuris = require("kyuris");

class ShardPreReady extends Kyuris.Event {

    constructor() {

        /* Eris's Events. See https://abal.moe/Eris/Client for an event overview */
        super("shardPreReady");

    }

    /**
     * @param {number} id The ID of the shard
     */
    async run(id) {

        Kyuris.Logger.info("KYURIS - SHARD-PRE-READY", `Shard ${id} Has Successfully Connected!`);

    }

}

module.exports = new ShardPreReady();
  • That's It! Your bot is now fully setup and ready to go as long as you didn't forgot to save your files :P

Why Kyuris?

  • Lightweight
  • Easy-To-Use
  • Up-To-Date
  • Customizable Behaviour

Resources Links

ToDo List:

  • 🚧 Proper Custom ready & messageCreate Events (messageCreate event is where Kyuris handles messages and commands (Making a custom messageCreate event isn't recommended at all unless you know what you're doing.)
  • ✖ Cluster Client
  • 🚧 More properties

License

Kyuris was released under the MIT License.