Welcome to Gatekeepers Regex section, In this section we will cover how to manage your Regex patterns with Gatekeeper.
Need to test your Regex? Regex Tester
Regular Expression, or regex in short, is extremely and amazingly powerful in searching and manipulating text strings.
- See PyDoc on Regex.
- We do have a few examples down below Examples.
This section covers the basic commands you will use to interact with Gatekeepers Regex Patterns.
- TIP: All Regex patterns can be used on multiple Servers.
For starters lets cover how to add a Regex Pattern.
- The command to add a Regex Pattern is
/bot regex_pattern add (name, filter_type, pattern).name: Must be unique. I suggest making it descriptive enough to tell them apart, I will explain why later.filter_type: You haveConsoleorEventsto pick from which dictates which Discord Channel the message will go to.pattern: This is where your Regular Expression goes.
- The command to delete a Regex Pattern is
/bot regex_pattern delete (name).name: This field will auto populate with the names of Regex Patterns already in the Database.
-
The command to update a Regex Pattern is
/bot regex_pattern update (name, new_name, filter_type, pattern).name: This field will auto populate with the names of Regex Patterns already in the Database.- These next fields are all optional, you can change one or all 3 at the same time.
new_name: Must be unique and must not match the currentname.filter_type: Same as add;ConsoleorEvents.pattern: This is where the "new" Regex pattern goes if you want to replace the existing one.
-
Use Cases:
- You have a pattern named
Minecraftwith thefilter_typeofConsole. You want to change itsfilter_typetoEvents.- So we will use
/bot regex_pattern update.- We select
Minecraftfor thenamefield. - We select
Eventsfor thefilter_typefield. - Then hit Enter to submit and viola, Gatekeeper will reply with the updated information.
- We select
- So we will use
- You have a pattern named
- The command to list all your Regex Patterns is
/bot regex_pattern list.- Gatekeeper will reply with an Embed styled list and provide information regarding each Regex in the Database.
As you noticed with Bot Regex Patterns the name field auto populates with all your created Regex patterns for ease of navigation.
- This is why it can become important to uniquely name your patterns.
- REMINDER: Any Regex pattern you have added to a Server will update when you use
/bot regex_pattern update
- The command to add a Regex Pattern to a Server is
/server regex add (server, name).server: This field will auto populate with all your AMP Instances for selection.name: This field will auto populate with all your Regex patterns from the Database.
- The command to delete a Regex Pattern from a Server is
/server regex delete (server, name).server: This field will auto populate with all your AMP Instances for selection.name: This field will auto populate with all your Regex patterns from the Database.
- The command to list all Regex Patterns a Server is using is
/server regex list (server).server: This field will auto populate with all your AMP Instances for selection.
- This means ANY matches to the Regex pattern will be captured and all other messages will be ommited.
- As you can see in the above example I created a Pattern named
Minecraftwith the filter_type set toConsole(Referred to as TYPE) via/bot regex_pattern add.- The Regex pattern is
(Player Console banned|You have been banned:|Player Console unbanned).
- The Regex pattern is
- You can see I added the Pattern named
MinecrafttoTestServer01then I setTestServer01Console filtering toTrueand set it toWhitelistvia/server console filter.- The result would be ANY MATCH to the pattern would be sent to
TestServer01Console Channel.
- The result would be ANY MATCH to the pattern would be sent to
Now here is another Regex pattern "(left the game|joined the game|tried to swim|completed the challenge|made the advancement|was slain by|fell off|was shot by)".
- We used
/bot regex_pattern addand set the filter_type toEvents. - With the above pattern and settings previously shown in the above examples. The two boxed strings from that Servers Console would be output to Discord.
- This means ANY matches to the Regex pattern will be ommitted and all other messages will pass through.
- As stated before; you can see I added the PATTERN named
whitelistand set the filter_type toConsole.- So any strings matching the Regex Pattern
(/whitelist)will be ommited.
- So any strings matching the Regex Pattern
- You can still see it inside the AMP Console, but if you notice in the below example that Discord doesn't have the
/whitelistentry.
-
'(Unkown command|players online:|Staff|Help|left the game|joined the game|lost connection:|whitelisted players:|was slain by|game mode to)' -
'(Player Console banned|You have been banned:|Player Console unbanned)' -
'(Added|to the whitelist|Removed|from the whitelist)' -
'(left the game|joined the game|tried to swim|completed the challenge|made the advancement|was slain by|fell off|was shot by)'




