From 07b50e5219489d569e18e6ffb27776af680a7b5a Mon Sep 17 00:00:00 2001 From: Josh Creek Date: Thu, 14 Jan 2021 17:47:53 +0000 Subject: [PATCH] feat(*): Update readme with instructions for adding a command --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 2f0d30c..1d84ddc 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,27 @@ An open source Discord bot for helping coders gain experience working on open so ## How to contribute (add your code to this project) You should fork this project and submit Pull Requests with your changes, ready to be code reviewed and merged into this project. + +## Add a command + +To add a command, edit the `commands.js` file. + +You need to create a function containing the code you want to run, and add a case that matches your desired command. + +For example, for the command 'example' you would need to add the case: + +```js +case 'example': + commandExample(Discord, config, logger, message, command, args); + break; +``` + +You would also need to add the function: + +```js +function commandExample (Discord, config, logger, message, command, args) { + // Your code goes here +} +``` + +Notice the naming convention for the function is 'command' followed by your desired command, in camelCase. For example, a command of `thisisalongcommand` would have a function called `commandThisIsALongCommand`.