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

coolcaedframework

v1.0.0

Published

A discord.js framework, making it easy to create commands and events, saving you the time of having to make a handler

Downloads

2

Readme

A discord.js framework, making it easy to create commands and events, saving you the time of having to make a handler. You can view the example code here

Yes the code of this is very messy it was kinda rushed

Creating the client

Name | Type | Required | Description ------------ | ------------- | ------------ | ------------ prefix | String | true | The prefix used at the start of commands token | String | true | The bots/users token of the account used to authenticate ownerId | String | false | The ID of the bots owner (not required if a selfbot) selfbot | Boolean | false | Is the bot a selfbot or normal bot eventsPath | String | true | The directory path for the event files inhibitorsPath | String | true | The directory path for the inhibitor files commandsPath | String | true | The directory path for the command files

const { Client } = require('coolcaedFramework');
const path = require('path');

const client = new Client({
    token: 'super-secret-token-here', // Token of the bot
    prefix: "!", // Prefix for bot commands
    selfbot: false, // Is the bot a selfbot or not
    ownerId: '199248578122612736', // Owner's id of the bot (can be empty if a selfbot)

    commandsPath: path.join(__dirname, 'commands'), // Path of the commands directory
    eventsPath: path.join(__dirname, 'events'), // Path of the events directory
    inhibitorsPath: path.join(__dirname, 'inhibitors') // Path of the events directory
});

client.login();

Creating an command

These commands will be executed by the prefix set on Client.prefix followed by the command name or one of the aliases

Name | Type | Required | Description ------------ | ------------- | ------------ | ------------ name | String | true | Name of the command description | String | false | Description of the command (what it does etc) aliases | Array | false | Command aliases (other triggers of the command) guildOnly | Bolean | false | Should the command only be allowed in guilds only? category | String | false | The category the command is in cooldown | Integer | false | Time a user should wait before doing the command again (in seconds) inhibitors | Array | false | Inhibitors that should be ran before calling the commands run function

const { Command } = require('coolcaedFramework');

module.exports = class extends Command {
    constructor(...args) {
        super(...args, {
            enabled: true,
            name: 'ping',
            description: 'Ping pong',
            category: 'General',
            guildOnly: true,
            cooldown: 3,
            aliases: ['pong'],
            inhibitors: ["isDev"]
        });
    }

    run(msg, args) {
        msg.channel.send('Pong');
    }
}

Creating an event

The code will be triggered when ever an event is emitted by discord.js

Name | Type | Required | Description ------------ | ------------- | ------------ | ------------ event | String | true | Name of the event once | Boolean | false | Should the event be ran once

const { Event } = require('coolcaedFramework');

module.exports = class extends Event {
    constructor(...args) {
        super(...args, {
            event: 'ready',
            once: true
        });
    }

    run() {
        console.log(`Logged in as ${this.client.user.tag}`);
    }
}

Creating an inhibitor

These are ran before the commands run function gets called, the name of the inhibitor should be passed into the Command.inhibitors array

name | Type | Required | Description ------------ | ------------- | ------------ | ------------ name | String | true | Name of the inhibitor

const { Inhibitor } = require('coolcaedFramework');

module.exports = class extends Inhibitor {
    constructor(...args) {
        super(...args, {
            enabled: true,
            name: 'isDev'
        });
    }

    run(msg, cmd) {
        if (!msg.author.id === this.client.ownerId) throw "You're not a developer";
    }
}

If you find any bugs or errors in this code, please contact me on discord: Caed#0024