- Clone the repository
- Run
npm i --save-dev
in a terminal in the directory - Create a file called
.env
and put your discord application'stoken
&clientId
inside - Run
node .
in your terminal - Done!
- Create a new file in the
commands
folder (the name of the file does not matter) - Import
createCommand.js
- Return the result of
createCommand()
as yourmodule.exports
Usage:
module.exports = createCommand(command_name, description, image_manipulator, data_manipulator?)
// command_name: The name of the command. This is what the user will see & type
// description: The text the user sees after typing the name of your command
// image_manipulator: The function which the image and interaction is passed to
// data_manipulator (OPTIONAL): The function which can manipulate the information the command contains, such as any extra arguments in your command
Example:
// commands/greyscale.js
const createCommand = require("../createCommand")
module.exports = createCommand("greyscale", "Turns an image greyscale", image => image.greyscale())
For an example containing a data_manipulator
function, see caption.js or resize.js