Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[api] Added barebones help commands.

  • Loading branch information...
commit 91852d8174948d6054a4459b659be4acb9ad82ef 1 parent 86d6da9
Charlie McConnell AvianFlu authored
Showing with 49 additions and 1 deletion.
  1. +48 −0 lib/plugins/help.js
  2. +1 −1  lib/triggers.js
48 lib/plugins/help.js
View
@@ -0,0 +1,48 @@
+/*
+ *
+ * help.js - kohai's interactive help system.
+ *
+ * (c) 2011 Nodejitsu Inc.
+ *
+ */
+
+var help = module.exports = function (data, command) {
+ if (command.length === 1) {
+ this.emit('sendMsg', {
+ dest: data.nick,
+ msg: 'Hi! I\'m ' + this.ircNick + '. For help topics, type `help list`.'
+ });
+ }
+ else if (command[1] in info) {
+ info[command[1]].call(this, data.nick);
+ }
+}
+
+var info = {
+
+ list: function (nick) {
+ var msg = 'Available help topics: ' + Object.keys(info).join(' ');
+ say.call(this, nick, msg);
+ },
+
+ password: function (nick) {
+ var msg = 'To reset your password, type `jitsu users forgot [username]`. To change it, type `jitsu users changepassword`.';
+ say.call(this, nick, msg);
+ },
+
+ handbook: function (nick) {
+ var msg = 'The complete Nodejitsu handbook can be read at http://github.com/nodejitsu/handbook';
+ say.call(this, nick, msg);
+ },
+
+ support: function (nick) {
+ var msg = 'For additional support, try support@nodejitsu.com or hang out in #nodejitsu!';
+ say.call(this, nick, msg);
+ }
+
+};
+
+
+function say(dest, msg) {
+ this.emit('sendMsg', { dest: dest, msg: msg });
+}
2  lib/triggers.js
View
@@ -111,7 +111,7 @@ var triggers = module.exports = {
if (!data.admin) { return false; }
var dest = command[2] || data.to;
console.log(command[1], ' has been unbanned from ', dest, ' at the request of ', data.nick);
- this.emit('sendMsg', { dest: dest, msg: 'Mercy has been bestowed upon ' + data.nick });
+ this.emit('sendMsg', { dest: dest, msg: 'Mercy has been bestowed upon ' + command[1] });
this.emit('command', 'mode ' + dest + ' -b ' + command[1]);
},
Please sign in to comment.
Something went wrong with that request. Please try again.