TextReplace: Do not apply rules in #textreplace-rules channel
This commit is contained in:
parent
6a57ecc22b
commit
bd95a25f4c
@ -191,6 +191,8 @@ function TextReplace({ title, rulesArray, rulesKey }: TextReplaceProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TEXT_REPLACE_RULES_CHANNEL_ID = "1102784112584040479";
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "TextReplace",
|
name: "TextReplace",
|
||||||
description: "Replace text in your messages. You can find pre-made rules in the #textreplace-rules channel in the Vencord Server",
|
description: "Replace text in your messages. You can find pre-made rules in the #textreplace-rules channel in the Vencord Server",
|
||||||
@ -203,7 +205,10 @@ export default definePlugin({
|
|||||||
stringRules = await DataStore.get(STRING_RULES_KEY) ?? makeEmptyRuleArray();
|
stringRules = await DataStore.get(STRING_RULES_KEY) ?? makeEmptyRuleArray();
|
||||||
regexRules = await DataStore.get(REGEX_RULES_KEY) ?? makeEmptyRuleArray();
|
regexRules = await DataStore.get(REGEX_RULES_KEY) ?? makeEmptyRuleArray();
|
||||||
|
|
||||||
this.preSend = addPreSendListener((_, msg) => {
|
this.preSend = addPreSendListener((channelId, msg) => {
|
||||||
|
// Channel used for sharing rules, applying rules here would be messy
|
||||||
|
if (channelId === TEXT_REPLACE_RULES_CHANNEL_ID) return;
|
||||||
|
|
||||||
// pad so that rules can use " word " to only match whole "word"
|
// pad so that rules can use " word " to only match whole "word"
|
||||||
msg.content = " " + msg.content + " ";
|
msg.content = " " + msg.content + " ";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user