mirror of
https://github.com/reality/dbot.git
synced 2025-01-12 13:12:41 +01:00
Consolidate puns and quotes modules [#90]
This commit is contained in:
parent
887e854012
commit
ae902e3c21
@ -1,25 +0,0 @@
|
|||||||
var puns = function(dbot) {
|
|
||||||
var name = 'puns';
|
|
||||||
var dbot = dbot;
|
|
||||||
|
|
||||||
return {
|
|
||||||
'name': name,
|
|
||||||
'ignorable': true,
|
|
||||||
|
|
||||||
'listener': function(event) {
|
|
||||||
event.user = dbot.cleanNick(event.user);
|
|
||||||
if(dbot.config.moduleNames.include('quotes') &&
|
|
||||||
dbot.db.quoteArrs.hasOwnProperty(event.user)) {
|
|
||||||
event.message = '~q ' + event.user;
|
|
||||||
event.action = 'PRIVMSG';
|
|
||||||
event.params = event.message.split(' ');
|
|
||||||
dbot.instance.emit(event);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'on': 'JOIN'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.fetch = function(dbot) {
|
|
||||||
return puns(dbot);
|
|
||||||
};
|
|
@ -265,38 +265,43 @@ var quotes = function(dbot) {
|
|||||||
'commands': commands,
|
'commands': commands,
|
||||||
|
|
||||||
'listener': function(event) {
|
'listener': function(event) {
|
||||||
// Reality Once listener
|
if(event.action == 'PRIVMSG') {
|
||||||
if((dbot.db.ignores.hasOwnProperty(event) &&
|
if((dbot.db.ignores.hasOwnProperty(event) &&
|
||||||
dbot.db.ignores[event.user].include(name)) == false) {
|
dbot.db.ignores[event.user].include(name)) == false) {
|
||||||
if(event.user == 'reality') {
|
if(event.user == 'reality') {
|
||||||
var once = event.message.valMatch(/^I ([\d\w\s,'-]* once)/, 2);
|
var once = event.message.valMatch(/^I ([\d\w\s,'-]* once)/, 2);
|
||||||
} else {
|
|
||||||
var once = event.message.valMatch(/^reality ([\d\w\s,'-]* once)/, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(once) {
|
|
||||||
if((dbot.db.bans.hasOwnProperty('~qadd') &&
|
|
||||||
dbot.db.bans['~qadd'].include(event.user)) ||
|
|
||||||
dbot.db.bans['*'].include(event.user)) {
|
|
||||||
event.reply(dbot.t('command_ban', {'user': event.user}));
|
|
||||||
} else {
|
} else {
|
||||||
if(!dbot.db.quoteArrs.hasOwnProperty('realityonce')) {
|
var once = event.message.valMatch(/^reality ([\d\w\s,'-]* once)/, 2);
|
||||||
dbot.db.quoteArrs['realityonce'] = [];
|
}
|
||||||
}
|
|
||||||
if(dbot.db.quoteArrs['realityonce'].include('reality ' + once[1] + '.')) {
|
if(once) {
|
||||||
event.reply(event.user + ': reality has already done that once.');
|
if((dbot.db.bans.hasOwnProperty('~qadd') &&
|
||||||
|
dbot.db.bans['~qadd'].include(event.user)) ||
|
||||||
|
dbot.db.bans['*'].include(event.user)) {
|
||||||
|
event.reply(dbot.t('command_ban', {'user': event.user}));
|
||||||
} else {
|
} else {
|
||||||
dbot.db.quoteArrs['realityonce'].push('reality ' + once[1] + '.');
|
if(!dbot.db.quoteArrs.hasOwnProperty('realityonce')) {
|
||||||
addStack.push('realityonce');
|
dbot.db.quoteArrs['realityonce'] = [];
|
||||||
rmAllowed = true;
|
}
|
||||||
event.reply('\'reality ' + once[1] + '.\' saved.');
|
if(dbot.db.quoteArrs['realityonce'].include('reality ' + once[1] + '.')) {
|
||||||
|
event.reply(event.user + ': reality has already done that once.');
|
||||||
|
} else {
|
||||||
|
dbot.db.quoteArrs['realityonce'].push('reality ' + once[1] + '.');
|
||||||
|
addStack.push('realityonce');
|
||||||
|
rmAllowed = true;
|
||||||
|
event.reply('\'reality ' + once[1] + '.\' saved.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if(event.action == 'JOIN') {
|
||||||
|
event.message = '~q ' + event.user;
|
||||||
|
event.action = 'PRIVMSG';
|
||||||
|
event.params = event.message.split(' ');
|
||||||
|
dbot.instance.emit(event);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'on': ['PRIVMSG', 'JOIN']
|
||||||
'on': 'PRIVMSG'
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user