NightDev Community Forums

Emote filter blacklist in nightbot

I am a moderator in one of the youtube streams and wanted to introduce a troll mode where only emotes are allowed. To prevent meta etc. So basically the idea is during this time, timeout all messages except the ones which only contains emojis list.

Example emojis list

How do I set the blacklist filter regex as “Everything” but this unicode list.

Thanks, in advance :smiley:

Hey @sitetrial101!

I recommend you look at this JavaScript RegExp Reference, it’s very helpful to learn the basics of RegExp.

To answer your question with a short example: [^abc].

1 Like

Hey Emily!! Thanks for replying. Really appreciate you for the help.

I did try recreating it a little here

For example not emote1 or emote2
^((?!emote1|emote2).)*$

But it doesn’t work. I read it on one of the older posts here that this type of regex is a negative lookahead regex which is not supported in nightbot.
So is there any way. To say do

Everything but emojis unicodes of range U+1F600…U+1F64F (Emoticons (Unicode block) - Wikipedia)

or everything but these words (where we can write emojis)

Appreciate all the help

You need to put it in brackets []:

So to modify your first RegExp, this should work:

/[^\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/gu

It’s true that we’ve had some issues with matching emotes, but from our tests we didn’t try using curly brackets {}, so maybe that’s the solution, I’d say give it a try and see.

1 Like

I am sorry to be a bother,

/[^\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/gu

This unfortunately din work. It din restrict any of the other words or characters.

I apologize for troubling more, when you said this should be in [],
^((?!emote1|emote2).)*$

I set this in spam protection
[^((?!emote1|emote2).)*$]

It works in regex tester

But in nightbot doesn’t end up banning any word :frowning:

I would really appreciate if you have any idea/direction on this.

Thanks!

Don’t worry, you’re not a bother, I expected this topic to be difficult to solve.

I now remember we had a similar issue recently, this might be the same thing, but first, do you put your RegExp between slashes? /RegExp/, so with the bit of code you put above: /[^((?!emote1|emote2).)*$]/
If it still doesn’t work, try with a tilde (~) before it: ~/RegExp/, ~/[^((?!emote1|emote2).)*$]/

Also, I didn’t specify it because I felt it was obvious, but just in case, to test if the RegExp is efficient, you need to test it with an account that’s not the streamer or a moderator.

1 Like