mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-18 02:47:03 -04:00
Merge remote-tracking branch 'upstream/main'
This commit is contained in:
commit
7155bdf764
12 changed files with 76 additions and 100 deletions
|
@ -26,6 +26,12 @@ import { Message } from "discord-types/general";
|
|||
|
||||
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
|
||||
|
||||
interface MessageDeleteProps {
|
||||
collapsedReason: {
|
||||
message: string;
|
||||
};
|
||||
}
|
||||
|
||||
export default definePlugin({
|
||||
name: "NoBlockedMessages",
|
||||
description: "Hides all blocked messages from chat completely.",
|
||||
|
@ -36,20 +42,20 @@ export default definePlugin({
|
|||
replacement: [
|
||||
{
|
||||
match: /let\{[^}]*collapsedReason[^}]*\}/,
|
||||
replace: "return null;$&"
|
||||
replace: "if($self.shouldHide(arguments[0]))return null;$&"
|
||||
}
|
||||
]
|
||||
},
|
||||
...[
|
||||
'"MessageStore"',
|
||||
'"displayName","ReadStateStore")'
|
||||
'"ReadStateStore"'
|
||||
].map(find => ({
|
||||
find,
|
||||
predicate: () => Settings.plugins.NoBlockedMessages.ignoreBlockedMessages === true,
|
||||
replacement: [
|
||||
{
|
||||
match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/,
|
||||
replace: (_, _funcName, props) => `if($self.isBlocked(${props}.message))return;`
|
||||
match: /(?<=MESSAGE_CREATE:function\((\i)\){)/,
|
||||
replace: (_, props) => `if($self.isBlocked(${props}.message))return;`
|
||||
}
|
||||
]
|
||||
})),
|
||||
|
@ -93,5 +99,9 @@ export default definePlugin({
|
|||
} catch (e) {
|
||||
new Logger("NoBlockedMessages").error("Failed to check if user is blocked:", e);
|
||||
}
|
||||
},
|
||||
|
||||
shouldHide(props: MessageDeleteProps) {
|
||||
return !props?.collapsedReason?.message.includes("deleted");
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue