forked from GitHub/dbot
Remove a bunch of useless users API functions, finish documentation [#352]
This commit is contained in:
parent
88c51209af
commit
7c31d5bbe8
@ -50,6 +50,11 @@ channel was found from the given parameters.
|
||||
Get a list of all users the bot currently knows about. Callback is called with
|
||||
one argument, a list of user records.
|
||||
|
||||
#### isOnline
|
||||
Is the given nick on the given server currently in the given channel. Callback
|
||||
is called with one argument, a boolean as to whether the nick is currently in
|
||||
the specified place.
|
||||
|
||||
### Data
|
||||
|
||||
#### User Object
|
||||
|
@ -79,42 +79,6 @@ var api = function(dbot) {
|
||||
});
|
||||
},
|
||||
|
||||
'isKnownUser': function(server, nick, callback) {
|
||||
this.api.resolveUser(server, nick, function(isKnown) {
|
||||
if(isKnown == false) {
|
||||
callback(false);
|
||||
} else {
|
||||
callback(true);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'isPrimaryUser': function(server, nick, callback) {
|
||||
var isPrimaryUser = false;
|
||||
this.db.search('users', {
|
||||
'server': server,
|
||||
'primaryNick': nick
|
||||
}, function(user) {
|
||||
isPrimaryUser = true;
|
||||
}, function(err) {
|
||||
if(!err) {
|
||||
callback(isPrimaryUser);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'getAliases': function(server, nick, callback) {
|
||||
var aliases;
|
||||
this.db.search('users', {
|
||||
'server': server,
|
||||
'primaryNick': nick
|
||||
}, function(result) {
|
||||
aliases = result.aliases;
|
||||
}, function(err) {
|
||||
callback(aliases);
|
||||
});
|
||||
},
|
||||
|
||||
'isOnline': function(server, nick, channel, callback) {
|
||||
this.api.resolveUser(server, nick, function(user) {
|
||||
var possiNicks = [user].concat(user.aliases);
|
||||
@ -129,13 +93,6 @@ var api = function(dbot) {
|
||||
callback(isOnline);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
'isChannelUser': function(server, nick, channel, callback) {
|
||||
this.api.resolveUser(server, nick, function(user) {
|
||||
var isChannelUser = _.include(user.channels, channel);
|
||||
callback(isChannelUser);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user