mirror of
https://github.com/Brandon-Rozek/Rozbot.git
synced 2024-11-07 20:30:34 -05:00
Replaced regex expression with tokens due to yo-lkajdfasad hello-adkflajfd and other random garbage being accepted
This commit is contained in:
parent
0795d27b67
commit
41628e583e
1 changed files with 2 additions and 3 deletions
|
@ -1,6 +1,5 @@
|
||||||
var Command = require('./Command.js');
|
var Command = require('./Command.js');
|
||||||
var grabTokens = require('../helpers/grabTokens.js');
|
var grabTokens = require('../helpers/grabTokens.js');
|
||||||
var greetings = "hello|hi|hey|yo|morning|afternoon|evening";
|
|
||||||
var happy = "yay|woo|yess|:D|:\\)"
|
var happy = "yay|woo|yess|:D|:\\)"
|
||||||
var url = "link|url";
|
var url = "link|url";
|
||||||
|
|
||||||
|
@ -15,7 +14,7 @@ var condition = function(text, userData) {
|
||||||
(new RegExp(happy, 'i').test(text)) ||
|
(new RegExp(happy, 'i').test(text)) ||
|
||||||
((tokens.contain("who") || tokens.contain("what")) && tokens.contain("brandon") && tokens.contain('rozek')) ||
|
((tokens.contain("who") || tokens.contain("what")) && tokens.contain("brandon") && tokens.contain('rozek')) ||
|
||||||
((tokens.contain("how") || tokens.contain("doing") || tokens.contain("up")) && tokens.contain("brandon")) ||
|
((tokens.contain("how") || tokens.contain("doing") || tokens.contain("up")) && tokens.contain("brandon")) ||
|
||||||
((tokens.superContain('rozbot') || privateMessage) && new RegExp(greetings, 'i').test(text)) ||
|
((tokens.superContain('rozbot') || privateMessage) && (tokens.contain("hello") || tokens.contain("hi") || tokens.contain("hey") || tokens.contain("yo") || tokens.contain("morning") || tokens.contain("afternoon") || tokens.contain("evening"))) ||
|
||||||
((tokens.superContain("rozbot") || privateMessage) && tokens.superContain("what") && (tokens.contain("up") || tokens.contain("doing"))) ||
|
((tokens.superContain("rozbot") || privateMessage) && tokens.superContain("what") && (tokens.contain("up") || tokens.contain("doing"))) ||
|
||||||
(tokens.superContain("rozbot") && tokens.superContain("what") && tokens.contain("job"))
|
(tokens.superContain("rozbot") && tokens.superContain("what") && tokens.contain("job"))
|
||||||
}
|
}
|
||||||
|
@ -83,7 +82,7 @@ module.exports = new Command("NaturalSpeech", condition, function(text, send, us
|
||||||
/*
|
/*
|
||||||
Good morning Rozbot! -> Hello [user]!
|
Good morning Rozbot! -> Hello [user]!
|
||||||
*/
|
*/
|
||||||
else if ((tokens.superContain('rozbot') || privateMessage) && new RegExp(greetings, 'i').test(text)) {
|
else if ((tokens.superContain('rozbot') || privateMessage) && (tokens.contain("hello") || tokens.contain("hi") || tokens.contain("hey") || tokens.contain("yo") || tokens.contain("morning") || tokens.contain("afternoon") || tokens.contain("evening"))) {
|
||||||
send("Hello " + from + "!");
|
send("Hello " + from + "!");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue