Skip to content

Regex filters

enonibobble edited this page Nov 30, 2024 · 1 revision

Regex filters

Before a manga is displayed, info about the manga is checked against the server's and channel's filters.

Template

The template is the string the regex is tested against. Before testing, the following placeholders will be replaced with the appropriate content.

  • {{title}}
    • E.g. Bocchi the Rock!
  • {{artist}}
    • E.g. Hamaji Aki
  • {{author}}
    • E.g. Hamaji Aki
  • {{platformId}}
    • E.g. mangadex
  • {{seriesId}}
    • E.g. 2e0fdb3b-632c-4f8f-a311-5b56952db647
  • {{tags}}
    • Each tag will be separated by a comma [,].
    • Currently MangaDex specific.
    • E.g. Comedy,4-Koma,Slice of Life,Music
  • {{contentRating}}
    • Can be any of the following:
      • Safe
      • Suggestive
      • Erotica
      • Pornographic
      • Unknown
    • Will use whatever MangaDex returns. If the platform is nhentai, this will always be Pornographic. Otherwise, it will most likely be Unknown.
    • E.g. Safe

Regex (Filter)

Any .NET-supported regex should be supported. The default flags are IgnoreCase (/i). The flags are currently not editable by server mods/admins. (If you think a flag should be on or can think of a case where editable flags would be useful/needed, please open a GitHub issue!)

Every filters' combined runtime can be no longer than (by default) 250ms. This is to (hopefully) prevent abuse. (If you are running your own instance of Dibari, this limit is configurable in the instance's config).

Filter type and Channel scope

Somehow i've made this hard to explain so i'll try my best.

Filter type specifies what behaviour should be followed when the filter matches. (Should the manga be blocked if the filter matches? Should only mangas that match the filter be allowed, and everything else blocked?)

Channel scope specifies whether the filter will apply in every channel except the specified channels (Exclude), or will only apply in the specified channels (Include).

For example, to block Bocchi the Rock in every channel except the #bocchi-spoilers channel, the filter would be as follows:

  • Template: {{title}}
  • Filter: bocchi the rock
  • Filter type: Block
  • Channel scope: Exclude
  • Channels: #bocchi-spoilers

Another example, to allow only Frieren to be pulled up in the #good-mangas-only channel, the filter would be as follows:

  • Template: {{title}}
  • Filter: frieren
  • Filter type: Allow
  • Channel scope: Include
  • Channels: #good-mangas-only

One more example, if you wanted every channel to only allow Oshi no Ko except the #other-series channel, the filter would be:

  • Template: {{title}}
  • Filter: oshi no ko
  • Filter type: Allow
  • Channel scope: Exclude
  • Channels: #other-series

And of course, if you want the filter to apply server-wide (no special channel treatment), Channel scope should be left on Exclude and Channels should be empty.

Common filters

Will list some potentially common filters you might want to use.

NSFW filter

  • Template: {{contentRating}}
  • Filter: (Erotica|Pornographic)
  • Filter type: Block
  • Channel scope: Exclude
  • Channels: #nsfw
Clone this wiki locally