Skip to content

Interacting with the bot

Zirak edited this page May 20, 2013 · 13 revisions

You run commands by sending

!!/commandName [commandArg0, [commandArg1, [...]]]

In a chatroom where the bot is present.

For example:


Will print something like this:

@yourUsername help, listen, eval, live, die, refresh, forget, ban, unban, info, jquery, choose, user, listcommands, purgecommands, define, norris, urban, parse, tell, mdn, beautify, convert, get, github-status, google, hang, learn, nudge, spec, stat, todo, undo

The !! is how you get the bot's attention. It looks at your message, line by line, and if a line starts with the invocation pattern, the bot reacts to that line. Do note that !! is simply the default, but it can be changed - for instance, in the online demo, you don't need to provide a prefix at all.

The / signifies "the following is a command". With the /, the bot tries to get the command desired, and call it with the given arguments. It then sends the result of the command to the user. If no command matching that name is found, it tries to find command names which look similar. Command-names are case insensitive.

Lacking the /, the bot tries to match the message against a series of regular-expressions, specified in bot.listeners. If a match is found, it executes the pairing callback, and like a command, relays the result to the user.

You can also provide it with >, which forwards it to javascript code evaluation:

!!> ['hello', 'world'].join(' ')
:42 "hello world"

Or c> which evaluates as CoffeeScript:

!!c> ['hello', 'world'].join ' '
:42 "hello world"

If nothing above matches, it prints out a semi-helpful error message: Y U NO MAEK SENSE!?

Actual documentation

(Note on special syntax: I notate optional arguments with [], but they do not actually appear in the invocation. So !!/commandName [arg0 [arg1 [...]]] means all these:

!!/commandName arg0
!!/commandName arg0 arg1
!!/commandName arg0 arg1 argN

Are all valid. While discussing syntax, default values be given to optional arguments like name=default, but again, the name= part does not appear. !!/commandName [foo=bar] means that lacking the first argument, its value will be bar, meaning that the following two are identical:

!!/commandName bar

These will be present throughout the wiki and in bot help messages. But enough about fish, let's discuss cutlery.)

  • Commands documentation can be found here.
  • Listeners documentation can be found here.
You can’t perform that action at this time.