mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 06:19:24 +01:00
regex better
This commit is contained in:
parent
886a4d3baa
commit
fed8cb6789
@ -5,10 +5,14 @@ var youAre = function(dbot) {
|
|||||||
'listener': function(data) {
|
'listener': function(data) {
|
||||||
var num = Math.floor(Math.random()*11);
|
var num = Math.floor(Math.random()*11);
|
||||||
var key = data.message.match(/ is|are ([\d\w\s']*),?\.?/);
|
var key = data.message.match(/ is|are ([\d\w\s']*),?\.?/);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(num == 1 && key != undefined) {
|
||||||
if(key[1].indexOf('and') !== -1) {
|
if(key[1].indexOf('and') !== -1) {
|
||||||
key[1] = key[1].split('and')[0];
|
key[1] = key[1].split('and')[0];
|
||||||
} // TODO: fix the regex to do this. i hate regex
|
} // TODO: fix the regex to do this. i hate regex
|
||||||
if(num == 1 && key != undefined) {
|
|
||||||
dbot.say(data.channel, data.user + ': You\'re ' + key[1]);
|
dbot.say(data.channel, data.user + ': You\'re ' + key[1]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user