mirror of
https://github.com/reality/dbot.git
synced 2024-11-30 07:59:25 +01:00
Fixed CTCP module and added some new commands
This commit is contained in:
parent
06f6491d99
commit
9e7153cf42
@ -1,22 +1,36 @@
|
|||||||
var ctcp = function(dbot) {
|
var ctcp = function(dbot) {
|
||||||
var commands = {
|
this.listener = function(event) {
|
||||||
"\x01VERSION\x01": function(event) {
|
var matches = event.message.match(/\u0001[\w]+\u0001/);
|
||||||
// the current client version
|
if(matches) {
|
||||||
event.replyNotice("\x01VERSION " + dbot.config.version + "\x01");
|
// We need the CTCP command
|
||||||
},
|
var question = matches[0];
|
||||||
"\x01CLIENTINFO\x01": function(event){
|
// Cut \u0001 characters from command
|
||||||
// a list of all supported CTCP commands
|
question = question.slice(1,question.length-1);
|
||||||
event.replyNotice("\x01CLIENTINFO SOURCE VERSION USERINFO\x01");
|
switch(question) {
|
||||||
},
|
case 'CLIENTINFO':
|
||||||
"\x01SOURCE\x01": function(event){
|
event.replyNotice("\u0001CLIENTINFO SOURCE VERSION USERINFO\u0001");
|
||||||
event.replyNotice("\x01SOURCE https://github.com/reality/depressionbot\x01");
|
break;
|
||||||
},
|
case 'FINGER':
|
||||||
"\x01USERINFO\x01": function(event){
|
event.replyNotice("\u0001FINGER STOP FINGERING ME BRO\u0001");
|
||||||
// a "witty" saying set by the user
|
break;
|
||||||
event.replyNotice("\z01USERINFO " + dbot.config.name + "\x01");
|
case 'SOURCE':
|
||||||
|
event.replyNotice("\u0001SOURCE "+dbot.config.repoRoot+"\u0001");
|
||||||
|
break;
|
||||||
|
case 'TIME':
|
||||||
|
var d = new Date();
|
||||||
|
event.replyNotice("\u0001TIME "+d.toISOString()+"\u0001");
|
||||||
|
break;
|
||||||
|
case 'USERINFO':
|
||||||
|
event.replyNotice("\u0001USERINFO "+dbot.config.name+"\u0001");
|
||||||
|
break;
|
||||||
|
case 'VERSION':
|
||||||
|
event.replyNotice("\u0001VERSION "+dbot.config.version+"\u0001");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
event.replyNotice("\u0001"+question+" Idk what you want. Try CLIENTINFO.\u0001");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.commands = commands;
|
};
|
||||||
this.on = 'PRIVMSG';
|
this.on = 'PRIVMSG';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user