discord_helper
Discord_helper is a package developed to help you make a discord bot.
Installation
Go to your project folder and install it via npm
npm install discord_helper
Usage
const discord = client = discordjs_helper = helper = client; helper;helperclient;
Documentation
For this all to work, you have to create a new instance of the helper. To do this, do the following
const helper = discordClient;
Now that you have your helper object, you can do the following things with it
registerCommand
Registers an command.
Arguments
- triggers (Type: String[]): The triggers that should run the specified command
- onExecute (Type: Function): The function that runs when the command is ran. Provided arguments: message (The message the command was ran in) and args (an array of strings representing the arguments given).
Example
helper
This will reply to everyone running (prefix)an
or (prefix)example
with Hello!
and log (MessageAuthor#1234) ran the example command!
to the console.
setPrefix
Sets the prefix for the command handler.
Arguments
- newPrefix (Type: String): The new prefix to set the prefix to
Example
helper
This will set the prefix for commands to ->
.
setCommands
THIS COMMAND HAS THE ABILITY TO BREAK YOUR BOT! PLEASE BE CAREFUL
With this function, you can override the entire commands object into what you want. Useful for registering many commands at once.
Arguments
- newCommands (Type: JSON[]): The commands you want to set.
- force (Type: Boolean): Are you sure?
Example
helper
This will set the entire commands list to just this. The only command will be "hi" or "hello", which responds with "hello!" when ran.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
(Note: Github project isnt set up yet, there is no way to contribute yet)