Skip to content
This repository was archived by the owner on Dec 17, 2020. It is now read-only.

Commands

TJ Horner edited this page Aug 11, 2015 · 1 revision

You can add commands to the bot, we already have a ton of StudentRND-related commands in commands.js. Commands are passed several arguments:

  • message - the message that was sent
  • args - an array of arguments that the command took
  • channel - the channel the message was sent from
  • username - username of the user who sent it

Example:

bot.addCommand("echo", "Echo your text", function(message, args, channel, username){
  // sendMessage calls the function we used earlier.
  bot.sendMessage(username + " said " + args.join(" "), channel);
  // This command would echo the user's text.
  // <someuser> echo Hello
  // <bot> someuser said Hello
});

Clone this wiki locally