Skip to content

Commit a755cda

Browse files
committed
add subtext and inline links regexes
1 parent a8457ab commit a755cda

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

regexes.html

+20-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,13 @@
158158
<a class="spam-name">Inline Links</a>
159159
<div class="grid-row">
160160
<p>Blocks links that show custom text and hide the actual link.</p>
161-
161+
<div class="setting">
162+
<div class="title-with-setting">
163+
<input type="checkbox" id="filter-disguised-only">
164+
Disguised URLs only
165+
</div>
166+
<p>When enabled, it will only block inline links that appear as a domain. For example: [example.com](treeben77.xyz)</p>
167+
</div>
162168
<div class="regex-results">
163169
<button class="copy-regex" id="copy-regex-inline-links">Copy</button>
164170
<a class="regex-output" id="regex-output-inline-links">
@@ -167,6 +173,19 @@
167173
</div>
168174
</div>
169175
</div>
176+
<div class="spam-type" id="subtext">
177+
<a class="spam-name">Subtext</a>
178+
<div class="grid-row">
179+
<p>Blocks messages which contain subtext, which is smaller text that may be used to create convincing fake offical Discord notices.</p>
180+
181+
<div class="regex-results">
182+
<button class="copy-regex" id="copy-regex-subtext">Copy</button>
183+
<a class="regex-output" id="regex-output-subtext">
184+
h[e3]ll[o0] w[o0]rld
185+
</a>
186+
</div>
187+
</div>
188+
</div>
170189
<div class="spam-type" id="email-address">
171190
<a class="spam-name">Email Addresses</a>
172191
<div class="grid-row">

static/regexes.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,22 @@ const regex_types = [
7474
copy_btn: document.getElementById("copy-regex-inline-links"),
7575
output: document.getElementById("regex-output-inline-links"),
7676
generator: function(settings) {
77-
return `\\[.*\\n*.*\\]\\(\\s*<?(?:https?://)?[a-z0-9_\\-\\.]*[a-z0-9_\\-]+\\.[a-z]{2,}.*>?\\s*\\)`
77+
if (settings.disguisedonly.checked) {
78+
return `\\[.*[a-z0-9_\\-]+\\.[a-z]{2,}[\\/]?.*\\]\\(<?(?:https?://)?[a-z0-9_\\-\\.]*[a-z0-9_\\-]+\\.[a-z]{2,}.*>?\\)`
79+
} else {
80+
return `\\[.*\\n*.*\\]\\(\\s*<?(?:https?://)?[a-z0-9_\\-\\.]*[a-z0-9_\\-]+\\.[a-z]{2,}.*>?\\s*\\)`
81+
};
82+
},
83+
setting_elements: {
84+
disguisedonly: document.getElementById("filter-disguised-only")
85+
}
86+
},
87+
{
88+
name: "subtext",
89+
copy_btn: document.getElementById("copy-regex-subtext"),
90+
output: document.getElementById("regex-output-subtext"),
91+
generator: function(settings) {
92+
return `(?m)^-#\\s.*$`
7893
},
7994
setting_elements: {}
8095
},
@@ -108,7 +123,7 @@ const regex_types = [
108123
if (settings.slider.value == 2) {
109124
return `^#\\s.*$`;
110125
} else {
111-
return `^#{1,${settings.slider.value - 1}}\\s.*$`;
126+
return `^(> )?#{1,${settings.slider.value - 1}}\\s.*$`;
112127
}
113128
},
114129
setting_elements: {

0 commit comments

Comments
 (0)