NoBlockedMessages: Fix conflict with MessageLogger (#2921)
This commit is contained in:
parent
91a32e22de
commit
1e01f85217
|
@ -25,6 +25,12 @@ import { Message } from "discord-types/general";
|
||||||
|
|
||||||
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
|
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
|
||||||
|
|
||||||
|
interface MessageDeleteProps {
|
||||||
|
collapsedReason: {
|
||||||
|
message: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "NoBlockedMessages",
|
name: "NoBlockedMessages",
|
||||||
description: "Hides all blocked messages from chat completely.",
|
description: "Hides all blocked messages from chat completely.",
|
||||||
|
@ -35,7 +41,7 @@ export default definePlugin({
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /let\{[^}]*collapsedReason[^}]*\}/,
|
match: /let\{[^}]*collapsedReason[^}]*\}/,
|
||||||
replace: "return null;$&"
|
replace: "if($self.shouldHide(arguments[0]))return null;$&"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -68,5 +74,9 @@ export default definePlugin({
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
new Logger("NoBlockedMessages").error("Failed to check if user is blocked:", e);
|
new Logger("NoBlockedMessages").error("Failed to check if user is blocked:", e);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
shouldHide(props: MessageDeleteProps) {
|
||||||
|
return !props?.collapsedReason?.message.includes("deleted");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue