Jarvis is a Node.js bot that strives to emulates the functionality of J.A.R.V.I.S. from the Iron Man movie series. Some of its commands can be found in commands.js.
Clone this repository and then run npm install
to install the server's dependencies. Finally, run node server.js
to fire up the server and navigate your web browser to localhost:3000
.
-
First, enter your new command into
commands.coffee
. The data that the user passed to the command can be accessed by thequery
variable.exports.myAwesomeCommand = (query, res) -> # Do something awesome.
-
Next, add your command's trigger, prefixed by an exclamation point, into the
switch
block inserver.coffee
. You will need to call the function you just created in the previous step. Also, note that the data the user passed to the command is themessage
parameter for the command's function. Theres
variable allows the function to send its output back to the user.when '!yourAwesomeCommandTrigger' then commands.myAwesomeCommand message, res
-
Finally, add your command's documentation into the object returned by
exports.getDocs()
inhelp.coffee
as the following:myAwesomeCommand: 'This is a description of myAwesomeCommand. `!yourAwesomeCommandTrigger query`'