Handles
For those of us who get frustrated with writing command handlers but don't quite want to use a full framework. Intended for use with Discord.js.
Documentation is available at handles.topkek.pw.
Getting started
Installation
npm install --save discord-handles
Or, if you want to risk cutting yourself, install the bleeding edge version:
npm install --save appellation/handles#master
Usually I try to avoid pushing broken code, but sometimes I move a little too fast.
The basics
const discord = ;const handles = ; const client = ;const handler = client; client;
This will automatically load all commands in the ./commands
directory and handle incoming messages. See Command
in the docs for information on how to format the exports of the files you place in ./commands
. Particularly of interest are the pre
, exec
, and post
methods. The loader and handler can be configured according to Config
options passed to the constructor.
const handler = client directory: './some/other/awesome/directory' prefixes: 'dank' 'memes';
Here's an example of what you might place in the ./commands
directory.
const MessageMentions Permissions = ;const Command Argument Validator = ; moduleexports = static { return 'banne' 'ban'; } async { await thisguild; await this ; const member = await this 'member' ; await this ; await this 'days' ; ; } async { await thisargsmember; return thisresponse; };