Link/URL Protection - Fix for false positives on ellipses

This particular extension: https://extensions.streamer.bot/t/link-url-protection/113 has been invaluable, but there’s one issue that has been cropping up more and more.

Whenever someone in chat types an ellipsis, followed immediately by a word without a space “such as…this” “or…like this”, it’s flagged as a URL and timed out the majority of the time.

If the ellipsis has a space afterwards “such as… this”, then it doesn’t get caught. I’ve tried reminding my chat to remember the space but people forget, or typo, or new chatters don’t know the issue.

My friend Drakinite gave me a fix to replace line 23 with this:

        string patternStart = @"(http:\/\/|https:\/\/)?[^ ]*[^.]\.(";

This both corrects the false positives on an ellipsis and catches single-letter URLs that were not caught previously.

This will not catch other false positives where there is a period between two words that look like but technically aren’t a link, but this mitigates false positives by a lot.

Is the regex on your version this?:

string pattern = @"(http:\/\/|https:\/\/)?[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*(\.[a-z]{2,10})((\/+)[^\/ ]*)*";

This regex should be accurate to what twitch makes a link and what it doesnt, and testing that regex with what you put as examples did not activate the bot.

It may also be a case of the version uploaded here being too old, in which case im actively working on that right now to update it :slight_smile:

EDIT: I just finished updating it and it includes the regex i posted, and i’ve tested it with your examples directly in my chat and it did not trigger it!

Thank you! I didn’t get notified of the reply because the email notice got sent to spam. Thanks for your work!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.