mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
Make non-regex word mutes case insensitive
This commit is contained in:
parent
e1481fc8ee
commit
5701946511
@ -22,7 +22,7 @@ function checkWordMute(
|
|||||||
let text = `${note.cw ?? ""} ${note.text ?? ""}`;
|
let text = `${note.cw ?? ""} ${note.text ?? ""}`;
|
||||||
if (note.files != null)
|
if (note.files != null)
|
||||||
text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`;
|
text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`;
|
||||||
text = text.trim();
|
text = text.trim().toLowerCase();
|
||||||
|
|
||||||
if (text === "") return false;
|
if (text === "") return false;
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ function checkWordMute(
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
keywords.length > 0 &&
|
keywords.length > 0 &&
|
||||||
keywords.every((keyword) => text.includes(keyword))
|
keywords.every((keyword) => text.includes(keyword.toLowerCase()))
|
||||||
)
|
)
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,7 +13,7 @@ function checkWordMute(
|
|||||||
let text = `${note.cw ?? ""} ${note.text ?? ""}`;
|
let text = `${note.cw ?? ""} ${note.text ?? ""}`;
|
||||||
if (note.files != null)
|
if (note.files != null)
|
||||||
text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`;
|
text += ` ${note.files.map((f) => f.comment ?? "").join(" ")}`;
|
||||||
text = text.trim();
|
text = text.trim().toLowerCase();
|
||||||
|
|
||||||
if (text === "") return NotMuted;
|
if (text === "") return NotMuted;
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ function checkWordMute(
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
keywords.length > 0 &&
|
keywords.length > 0 &&
|
||||||
keywords.every((keyword) => text.includes(keyword))
|
keywords.every((keyword) => text.includes(keyword.toLowerCase()))
|
||||||
) {
|
) {
|
||||||
result.muted = true;
|
result.muted = true;
|
||||||
result.matched.push(...keywords);
|
result.matched.push(...keywords);
|
||||||
|
Loading…
Reference in New Issue
Block a user