Browse Source

regex battle2

master
calexil 1 year ago
parent
commit
dad6ddf3ab
2 changed files with 24 additions and 4 deletions
  1. 12
    2
      bot.js
  2. 12
    2
      bot.js~

+ 12
- 2
bot.js View File

@@ -9,12 +9,12 @@ const bodyParser = require('body-parser');
// Message Array
const responseObject = {
"test": "It worked!",
"best girl?": "Big Band.",
/* "best girl?": "Big Band.",
"best girl": "Big Band.",
"best grill": "Big Band.",
"best grill?": "Big Band.",
"best gurl": "Big Band.",
"best gurl?": "Big Band.",
"best gurl?": "Big Band.",*/
"best booty": "Squigly, Duh.",
"best booty?": "Squigly, Duh.",
"hi": "Hello there, I'm a dumb bot written by [@calexil#9270](https://github.com/calexil) and [@Timberius#8180](https://github.com/TimboKZ) , you can see my commands here: https://github.com/calexil/BansheeBot/blob/master/Commands.md",
@@ -63,6 +63,16 @@ client.on("message", (message) => {
client.on("message", (message) => {
message.channel.send(message.content.replace(/best g(ir|ri|ur)l+\??/g, "Big Band."));
});*/
let rg = /best g(ir|ri|ur)l+\??/igy;
client.on( "message", (message) -> {
let m = message.content.replace( rg, "Big Band" );
if( rg.lastIndex > 0 ) {
message.channel.send(m);
}
} );


// Ping server every 15 minutes to prevent web dyno from sleeping
var http = require("http");

+ 12
- 2
bot.js~ View File

@@ -59,10 +59,20 @@ client.on("message", (message) => {
});


// Reply to regex regarding best girl
/*// Reply to regex regarding best girl
client.on("message", (message) => {
message.channel.send(message.content.replace(/best g(ir|ri|ur)l+\??/g, "Big Band."));
});
});*/
let rg = /best g(ir|ri|ur)l+\??/igy;
client.on( "message", (message) -> {
let m = message.content.replace( rg, "Big Band" );
if( rg.lastIndex > 0 ) {
message.channel.send(m);
}
} );


// Ping server every 15 minutes to prevent web dyno from sleeping
var http = require("http");

Loading…
Cancel
Save