From 678a2ed9be200902b0d0a2964f6c6db9752c19b0 Mon Sep 17 00:00:00 2001 From: Psychedelic Squid Date: Fri, 9 Mar 2012 21:44:05 +0000 Subject: [PATCH] admin 'act' command, and fix to action syntax. --- modules/admin.js | 16 +++++++++++++++- run.js | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/admin.js b/modules/admin.js index d1dfc26..a8a14cd 100644 --- a/modules/admin.js +++ b/modules/admin.js @@ -24,11 +24,25 @@ var adminCommands = function(dbot) { }, 'say': function(data, params) { - var c = params[1]; + if (params[1] === "@") { + var c = data.channel; + } else { + var c = params[1]; + } var m = params.slice(2).join(' '); dbot.say(c, m); }, + 'act': function(data, params) { + if (params[1] === "@") { + var c = data.channel; + } else { + var c = params[1]; + } + var m = params.slice(2).join(' '); + dbot.act(c, m); + }, + 'load': function(data, params) { dbot.moduleNames.push(params[1]); dbot.reloadModules(); diff --git a/run.js b/run.js index 1071f15..9f4a2eb 100644 --- a/run.js +++ b/run.js @@ -83,7 +83,7 @@ DBot.prototype.say = function(channel, data) { }; DBot.prototype.act = function(channel, data) { - this.instance.send('PRIVMSG', channel, ':\001ACTION' + data + '\001'); + this.instance.send('PRIVMSG', channel, ':\001ACTION ' + data + '\001'); } // Save the database file