0.0.2-alpha.3 • Published 7 years ago

@discordbuddy/common v0.0.2-alpha.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

DiscordBuddy - Common

This package includes some common modules and argument types for DiscordBuddy. These argument types will range from a normal string type to a discord object.

Currently DiscordBuddy requires you to register CoreModule in your bootstrap module, however if you'd like to have some more arguments available you can import the CommonModule from this package. Below are some examples on how to import the module and how to use the argument types in your commands.

// MainModule.ts

import { Module } from '@discordbuddy/core';
import { CommonModule } from '@discordbuddy/common';

import { SomeCommand } from './commands/SomeCommand';

@Module({
    commands: [SomeCommand],
    imports: [CommonModule]
})
export class MainModule {}
// commands/SomeCommand.ts

import { Command, Message } from '@discordbuddy/core';
import { StringType } from '@discordbuddy/common';

@Command({
    name: 'some',
    description: 'A command with a string argument type',
    args: [{
        key: 'aString',
        type: StringType
    }]
})
export class SomeCommand {

    public async run(message: Message, args) {
        message.reply(`Got ${args.length} argument(s)\naString: ${args.aString}`);
    }
}