@discord-factory/basic-commands
v1.2.1
Published
The [Discord Factory](https://github.com/DiscordFactory/factory) framework no longer includes the use of commands via the `messageCreate` event by default.
Downloads
6
Readme
📦 Basic commands
The Discord Factory framework no longer includes the use of commands via the messageCreate
event by default.
The @discord-factory/basic-commands
module allows you to restore the use of these commands.
In order to use the module, you need to take the following steps:
npm install @discord-factory/basic-commands
# or
yarn add @discord-factory/basic-commands
Add the module to the plugins in the App/start/Kernel.ts
file:
import BasicCommands from '@discord-factory/basic-commands
export default class Kernel {
public registerAddons () {
return [
() => BasicCommands, 👈 // Do not instanciate it
]
}
}
You can generate a command file by using the command below: With NPM
npm run ace make:basic-command MyCommand
With YARN
yarn ace make:basic-command MyCommand
Now you will need to add 2 keys to your environment file :
BASIC_COMMANDS:
APP_PREFIX: Your prefix
COMMAND_AUTO_REMOVE: true # or 'false'
"BASIC_COMMANDS": {
"APP_PREFIX": "Your prefix"
"COMMAND_AUTO_REMOVE": true // or 'false'
}
Once added, you can now create your orders with this minimal structure
import { Command, BaseCommand } from '@discord-factory/basic-commands'
import { Message } from 'ioc:factory/Discord/Event'
@Command({
label: 'Foo command',
description: 'Foo description',
tag: 'foo'
})
export default class FooCommand extends BaseCommand {
public async run (message: Message, args: string[]): Promise<void> {
// Your code here
}
}
License
MIT License © 2021 Baptiste Parmantier