Twitchat icon indicating copy to clipboard operation
Twitchat copied to clipboard

Suggestion - Add an advanced option for chat command hide functionality

Open Nahalyd opened this issue 10 months ago • 1 comments

Context:

  • Some users use command with text after to troll the streamer
  • If the streamer has set a command block rule, all messages starting with the command text will be hidden.

Suggestion:

  • An option to precise if the streamer wants to hide all messages, or only those starting and ending by the command text, would be the solution
  • Technically, it should be a condition to add a regular expression anchor ($) at the end of the filtered text.
  • For the implementation, with the current UI, you could simply permit to type "$" after the command text to block, in order to enable the option. (not perfect but efficient)

Edit: typo

Nahalyd avatar Mar 29 '24 17:03 Nahalyd

Hello !

First of all, sorry for very late answer.

The possibility to filter by regexp wouldn't be technically complicated but may have bad impacts on performances :/ There are lots of tests to define wether a message should be displayed on a column or not and a regex is ~20 times slower than the current indexOf solution.

str.indexOf("!") //~1ms for 1 000 000 execs
/!\S+/g.test(str) //~20-25ms for 1 000 000 execs

Now, even if it's comparatively slower, it actually remains very low numbers so switching for regexp probably wouldn't be so bad for performances. I'd just need to make sure users don't input massive regexp that would really kill performances.

I'll try to see if I make this possible vor v13

Durss avatar Jun 27 '24 14:06 Durss