1.0.0 • Published 2 years ago
@commandhandler/service-discord.js v1.0.0
@commandhandler/service-discord.js
DiscordJS service implementation for @commandhandler/core
Installation
npm i @commandhanlder/core @logmanager/service-discord.js
Quick Start
import { CommandHandler, StandardArgument, Command, RequireArgumentCommandError } from "@commandhandler/core"
import { DiscordImplementation } from "@commandhandler/service-discord.js"
const commandHander = new CommandHandler();
await commandHandler.addService(new DiscordImplementation.createClient(process.env.DISCORD_TOKEN))
class PingCommand extends Command<StandardArgument> {
readonly name = "ping"
readonly description = "Ping command"
async onExec(context: CommandExecutionContext, event: CommandExecEvent<Dispatcher, PingCommand>): Promise<void> {
await event.actions.reply("pong!")
}
}
await commandHandler.addCommand(new PingCommand())