@discordbuddy/common
TypeScript icon, indicating that this package has built-in type declarations

0.0.2-alpha.3 • Public • Published

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}`);
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @discordbuddy/common

Weekly Downloads

0

Version

0.0.2-alpha.3

License

MIT

Last publish

Collaborators

  • victionn
  • itsdizzy