3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-18 00:22:35 +01:00

expose hostmask stuff in commands [Close #518]

This commit is contained in:
reality 2013-06-27 18:06:49 +00:00
parent 9b8148f2e7
commit c1cd9755e4

View File

@ -24,6 +24,33 @@ var nickserv = function(dbot) {
} }
}; };
this.commands = {
'~auth': function(event) {
var user = event.params[1] || event.user;
this.api.auth(event.server, user, function(isAuthed) {
if(isAuthed) {
event.reply(dbot.t('authed', { 'nick': user }));
} else {
event.reply(dbot.t('not_authed', { 'nick': user }));
}
});
},
'~hostmask': function(event) {
var user = event.params[1] || event.user;
this.api.getUserHost(event.server, user, function(host) {
if(host) {
event.reply(dbot.t('hostmask', {
'nick': user,
'host': host
}));
} else {
event.reply(dbot.t('no_hostmask', { 'nick': user }));
}
});
}
};
this.listener = function(event) { this.listener = function(event) {
if(event.action == 'NOTICE') { if(event.action == 'NOTICE') {
var nickserv = dbot.config.servers[event.server].nickserv, var nickserv = dbot.config.servers[event.server].nickserv,
@ -33,7 +60,7 @@ var nickserv = function(dbot) {
if(event.user == nickserv) { if(event.user == nickserv) {
var info = event.params.match(statusRegex); var info = event.params.match(statusRegex);
if(info && _.has(this.authStack, event.server)) { if(info && _.has(this.authStack, event.server)) {
if(info[2] == acceptableState ) { if(info[2] == acceptableState) {
this.authStack[event.server][info[1]](true); this.authStack[event.server][info[1]](true);
} else { } else {
this.authStack[event.server][info[1]](false); this.authStack[event.server][info[1]](false);