forked from GitHub/dbot
Merge pull request #318 from JohnMaguire2013/users
fixes the issue where users are not tracked correctly on some IRCd's
This commit is contained in:
commit
ea948a4ae4
@ -12,12 +12,8 @@ var commands = function(dbot) {
|
|||||||
|
|
||||||
if(aliasCount != 0) {
|
if(aliasCount != 0) {
|
||||||
var aliases = _.first(aliases, 10);
|
var aliases = _.first(aliases, 10);
|
||||||
var including = 'including: ';
|
var including = 'including: ' + aliases.join(', ') + '.';
|
||||||
for(var i=0;i<aliases.length;i++) {
|
|
||||||
including += aliases[i] + ', ';
|
|
||||||
}
|
|
||||||
including = including.slice(0, -2) + '.';
|
|
||||||
|
|
||||||
event.reply(dbot.t('primary', {
|
event.reply(dbot.t('primary', {
|
||||||
'user': alias,
|
'user': alias,
|
||||||
'count': aliasCount
|
'count': aliasCount
|
||||||
@ -26,7 +22,7 @@ var commands = function(dbot) {
|
|||||||
event.reply(dbot.t('primary', {
|
event.reply(dbot.t('primary', {
|
||||||
'user': alias,
|
'user': alias,
|
||||||
'count': aliasCount
|
'count': aliasCount
|
||||||
}));
|
}).slice(0, -2) + ".");
|
||||||
}
|
}
|
||||||
} else if(_.has(knownUsers.aliases, alias)) {
|
} else if(_.has(knownUsers.aliases, alias)) {
|
||||||
event.reply(dbot.t('alias', {
|
event.reply(dbot.t('alias', {
|
||||||
@ -100,7 +96,11 @@ var commands = function(dbot) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
commands['~alias'].regex = [/^~alias ([\d\w[\]{}^|\\`_-]+?)/, 2];
|
||||||
|
commands['~setaliasparent'].regex = [/^~setaliasparent ([\d\w[\]{}^|\\`_-]+?)/, 2];
|
||||||
|
commands['~mergeusers'].regex = [/^~mergeusers ([\d\w[\]{}^|\\`_-]+?)\s*?([\d\w[\]{}^|\\`_-]+?)/, 3];
|
||||||
|
|
||||||
commands['~setaliasparent'].access = 'moderator';
|
commands['~setaliasparent'].access = 'moderator';
|
||||||
commands['~mergeusers'].access = 'moderator';
|
commands['~mergeusers'].access = 'moderator';
|
||||||
|
|
||||||
|
5
modules/users/usage.json
Normal file
5
modules/users/usage.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"~alias": "~alias [nick]",
|
||||||
|
"~setaliasparent": "~setaliasparent [nick]",
|
||||||
|
"~mergeusers": "~mergeusers [primary] [secondary]"
|
||||||
|
}
|
@ -38,7 +38,7 @@ var users = function(dbot) {
|
|||||||
var knownUsers = this.getServerUsers(event.server);
|
var knownUsers = this.getServerUsers(event.server);
|
||||||
var nick = event.user;
|
var nick = event.user;
|
||||||
|
|
||||||
if(event.action == 'JOIN') {
|
if(event.action == 'JOIN' && nick != dbot.config.name) {
|
||||||
if(!_.has(knownUsers.channelUsers, event.channel.name)) {
|
if(!_.has(knownUsers.channelUsers, event.channel.name)) {
|
||||||
knownUsers.channelUsers[event.channel.name] = [];
|
knownUsers.channelUsers[event.channel.name] = [];
|
||||||
}
|
}
|
||||||
@ -55,7 +55,9 @@ var users = function(dbot) {
|
|||||||
channelUsers.push(nick);
|
channelUsers.push(nick);
|
||||||
}
|
}
|
||||||
} else if(event.action == 'NICK') {
|
} else if(event.action == 'NICK') {
|
||||||
var newNick = event.params.substr(1);
|
// remove the first character from the NICK message if it is a :,
|
||||||
|
// due to some IRCd's disregarding RFC 1459 and adding a :
|
||||||
|
var newNick = (event.params[0] == ":" ? event.params.substr(1) : event.params);
|
||||||
if(!this.api.isKnownUser(newNick)) {
|
if(!this.api.isKnownUser(newNick)) {
|
||||||
knownUsers.aliases[newNick] = this.api.resolveUser(event.server, event.user);
|
knownUsers.aliases[newNick] = this.api.resolveUser(event.server, event.user);
|
||||||
dbot.api.event.emit('nick_change', [ event.server, newNick ]);
|
dbot.api.event.emit('nick_change', [ event.server, newNick ]);
|
||||||
|
Loading…
Reference in New Issue
Block a user