RegEx Chat Filter

Discussion in 'Plugin Requests' started by MPG1, Aug 1, 2020 at 10:59 AM.

  1. Offline


    • Version: 1.14.4 Spigot
    • Category: Chat
    • Suggested Name: RegExChat
    • Due: A.S.A.P i guess
    You might say there are already RegEx filters out there. I tried some, looked over others, but none fit the bill. I'm looking for the most simple it can get.
    If anything matching a regex expression is sent in chat or with configurable commands, it will be replaced with a configurable character.
    Regex expressions will be stored in a text backend, 1 expression per line. (filter.txt)

    /regex add <filter> (regex.add):
       Adds a regex expression to the filter list.
    /regex remove <number> (regex.remove):
       Prints a list of filters, click one to remove it. (with toggleable confirm)
    /regex list (regex.list):
       Prints a list of the filters, and the replacement character.
    /regex debug [textfile?] (regex.debug):
       Prints all the messages that matched an expression in the console/textfile in this format:
          <timestamp> "%text%" - %filter%
    Other Permissions:
    regex.bypass.<filter number>:
    Allows you to bypass the filter indicated.
    Allows you to bypass all filters.
    Last edited: Aug 2, 2020 at 10:39 AM
  2. Offline

    timtower Moderator Moderator

    @MPG1 Send where? Chat? Or should it also replace messages by plugins?
    Could you post an example file?
  3. Offline


    I made edits in italic, for ease of finding.
    replacechar: "*" # character to replace regex matches
    chatcommands: # commands to filter regex from
    - me
    - w
    - r
    - etc...
    d+((\s|_|-)*|.{1,2})(i|1)+((\s|_|-)*|.{1,2})c+((\s|_|-)*|.{1,2})(k|c)+ #example filter for d*ck
    l(a|4)g # example filter for "lag"
    debug.txt (if applicable):
    <timestamp> "lag" - l(a|4)g
  4. Offline

    timtower Moderator Moderator

    @MPG1 checking commands is not easy, or it is just chat or it is with all messages send to the player.
  5. Offline


    Yea- the latter.
    Any message sent with a command in the list.
    I think that's a thing in EssentialsXchat, so it should be possible.
  6. Offline

    timtower Moderator Moderator

    @MPG1 EssentialsChat does not handle plugin messages like worldedit, if this is done then it will be done based on packets, not on hooking into specific plugins.
  7. Offline


    @MPG1 I haven't tried this with other plugins so, i'm not sure how compatible it is.

    Anyway, try this.

    Note: I'm not done, i just wanted to give you a "preview" file. The replacing as well as the "/regex add (some filter here)" command should already be working, it's just the other 3 commands. I also wanted to add a parameter of sorts to the config so it can be like "- tell 2,3" or something. I'm thinking those will be used to exclude arguments from the commands so you won't censor the player's name when trying to send them a message.

    Let me know what you think about the idea and the "preview" plugin.
  8. Offline


    Thanks! I will try this A.S.A.P, and I am really thankful for this. Hooray!
    KarimAKL likes this.

Share This Page