1.1.1 • Published 3 years ago

aidyn v1.1.1

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

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

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.3.0

5 years ago

0.2.23

5 years ago

0.2.22

5 years ago

0.2.21

5 years ago

0.2.20

5 years ago

0.2.19

5 years ago

0.2.18

5 years ago

0.2.17

5 years ago

0.2.16

5 years ago

0.2.15

5 years ago

0.2.13

5 years ago

0.2.12

5 years ago

0.2.11

5 years ago

0.2.10

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.20

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago