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

that should do it

This commit is contained in:
reality 2014-09-08 10:41:09 +00:00
parent 57742d13f2
commit 63ded5b197

View File

@ -16,11 +16,14 @@ var quotes = function(dbot) {
if(quoteRefs) {
var ref = this.internalAPI.cleanRef(quoteRefs[0].replace(/^~~/,'').replace(/~~$/,'').trim());
if(ref === '-nicks-') {
dbot.api.users.getRandomChannelUser(server, channel, function(user) {
quote = quote.replace('~~' + ref + '~~', user);
if(_.has(dbot.instance.connections[server].channels, channel)) {
var nicks =
_.keys(dbot.instance.connections[server].channels[channel].nicks);
var randomUser = nicks[_.random(0, nicks.length -1)];
quote = quote.replace('~~' + ref + '~~', randomUser);
this.internalAPI.interpolatedQuote(server, channel,
username, key, quote, callback);
}.bind(this));
}
} else if(ref === '-nick-') {
quote = quote.replace('~~' + ref + '~~', username);
this.internalAPI.interpolatedQuote(server, channel,