NoBlockedMessages: Fix for new i18n lib (#2996)

This commit is contained in:
sadan4 2024-11-05 17:01:52 -05:00 committed by GitHub
parent 439a4f8eb6
commit 9d4e859a0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 8 deletions

View file

@ -18,17 +18,18 @@
import { Settings } from "@api/Settings";
import { Devs } from "@utils/constants";
import { runtimeHashMessageKey } from "@utils/intlHash";
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { i18n } from "@webpack/common";
import { Message } from "discord-types/general";
const RelationshipStore = findByPropsLazy("getRelationships", "isBlocked");
interface MessageDeleteProps {
collapsedReason: {
message: string;
};
// i18n message i18n.t["+FcYMz"] if deleted, with args
collapsedReason: () => any
}
export default definePlugin({
@ -77,6 +78,11 @@ export default definePlugin({
},
shouldHide(props: MessageDeleteProps) {
return !props?.collapsedReason?.message.includes("deleted");
try {
return props.collapsedReason() === i18n.t[runtimeHashMessageKey("BLOCKED_MESSAGE_COUNT")]();
} catch (e) {
console.error(e);
}
return false;
}
});