Merge github.com:reality/dbot into database

This commit is contained in:
reality 2013-06-27 18:13:11 +00:00
commit f924686871
2 changed files with 42 additions and 1 deletions

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) {
if(event.action == 'NOTICE') {
var nickserv = dbot.config.servers[event.server].nickserv,
@ -33,7 +60,7 @@ var nickserv = function(dbot) {
if(event.user == nickserv) {
var info = event.params.match(statusRegex);
if(info && _.has(this.authStack, event.server)) {
if(info[2] == acceptableState ) {
if(info[2] == acceptableState) {
this.authStack[event.server][info[1]](true);
} else {
this.authStack[event.server][info[1]](false);

View File

@ -0,0 +1,14 @@
{
"authed": {
"en": "{nick} is authed with nickserv."
},
"not_authed": {
"en": "{nick} is not authed with nickserv."
},
"hostmask": {
"en": "Hostmask for {nick}: {host}"
},
"no_hostmask": {
"en": "No hostmask could be found for {nick}"
}
}