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

aidyn

v1.1.1

Published

Aidyn: Discord Bot Framework

Downloads

2,466

Readme

Aidyn: Discord Bot Framework

install size

Simple Framework for rapidly building Discord Bot Commands jumping straight to the business logic

Features

  • Class based architecture
  • Native Typescript Support
  • Built upon the wonderful Discord.JS
  • State based data handling between commands
  • Support for automatic database backup via MongoDB

Installing

Using npm:

$ npm install aidyn

Using yarn:

$ yarn install aidyn

Requirements

Node v8 LTS or higher

Example

Creating a Class

Javascript

class ExampleCommand extends Command {
    static get NAME() {
        return 'example'
    }

    Name() { 
        return ExampleCommand.NAME
    }
    
    Namespace() { 
        return 'ExampleNamespace'
    }

    Run(message) {
        const context = this.GetContext(message);

        return message.channel.send(`Command: %example was called with content ${JSON.stringify(context)}`);
    }
}

Typescript

class ExampleCommand extends Command {
    static NAME  = 'example';

    public Name(): string { 
        return ExampleCommand.NAME;
    }
    public Namespace(): string { 
        return 'ExampleNamespace';
    }

    public async Run(message: Message): Promise<any> {
        const context = this.GetContext(message);

        return message.channel.send(`Command: %example was called with content ${JSON.stringify(context)}`);
    }
}

Using the framework/class

    const commands = {};
    const prefix = '%';

    comands[ExampleCommand.NAME] = ExampleCommand;
    const aidyn = new Aidyn({
        Prefix: prefix,
        ConnectionString: '',
        BotToken: '',
        Logging: 0
    });

    aidyn.start(commands);

Aidyn Constructor Params

    const aidyn = new Aidyn({
        ConnectionString: conString, // Database Connection String for a Mongo DB
        BotToken: token, // Discord Bot Token
        Prefix: prefix, // bot prefix, defaults to `%`
        Logging: 0 // (EXPERIMENTAL) 0 for no logging, 1 to log commands, 2 to log everything (NOT RECOMMENDED/),
        CustomProcessor: null // If you need to extend your own processor, you can inject it using this param
    })

Message GetContext

GetContext method of the Command class will process the contents of the message received. Any word that begins with -- will be added as a property of the resulting object, everything esle will end up being pushed into a generic args property which is an array of strings

Database

Currently, the framework only supports MongoDB

TypeScript

The project is built in tyepscript and thus comes with 100% typescript support out the box

Credits

DiscordJS for making the amazing library they've created Pixel Pub for being giunea pigs

License

MIT