cs-discord-at-ucf / lion

🦁A Discord bot from scratch for the UCF Computer Science Discord.
MIT License
42 stars 18 forks source link

Bad blacklist regex leading to incorrect link warnings #214

Closed xNul closed 4 years ago

xNul commented 4 years ago

Every time I send the message "group members" in the CS Discord, I get a dm warning from Lion about sharing GroupMe links in the discord. The problem seems to lie with some bad regex in the blacklist handler here. https://github.com/joey-colon/lion/blob/1ea14a31bafe5a577f19b3dca52ec989cd3fb05a/src/app/handlers/blacklist.handler.ts#L14 I'd fix it myself but I don't want to setup a whole instance of the bot to verify everything works correctly.

c650 commented 4 years ago

Anyone wanna take this?

tanndlin commented 4 years ago

I believe /group\s?me($|\W)/ would work Check to see if there is an end of input or non letter character

c650 commented 4 years ago

yeah that's what i was thinking

tanndlin commented 4 years ago

Only issue is if someone said groupmes. It wouldn't detect that

tanndlin commented 4 years ago

The regex's in this file seem to target specific links, but the one for group me doesn't, is there a reason for that?

CallumCoy commented 4 years ago

Probably just the hate of it from the creator. my 2cents I think /group\W?mes?\W/m would do the trick. Sample attached.

Edit: /group\W?mes?(\W|$)/m forgot to check for end of message. Also not sure what a groupme link looks like actually.

Edit Edit: /group\W?mes?(\W|$)/mi add the i in there to make sure they don't spookify GroUPmE.

Screenshot from 2020-10-27 18-04-06

tanndlin commented 4 years ago

Yeah, I'd create a PR and fix it but idk what a groupme link looks like. I feel like that'd be the ultimate solution

c650 commented 4 years ago

agree

tanndlin commented 4 years ago

/groupme\.com/ Should work if we only want to target links like the rest of the regex's. Want me to create a PR?

c650 commented 4 years ago

sure