Seaswimmer 2024-04-27 13:49:02 -04:00
commit 101e25329e
5 changed files with 13 additions and 21 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "vencord", "name": "vencord",
"private": "true", "private": "true",
"version": "1.7.8", "version": "1.7.9",
"description": "The cutest Discord client mod", "description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme", "homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": { "bugs": {

View file

@ -7,22 +7,12 @@
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { getCurrentChannel } from "@utils/discord"; import { getCurrentChannel } from "@utils/discord";
import { makeLazy } from "@utils/lazy";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { filters, find, findByPropsLazy, handleModuleNotFound } from "@webpack"; import { findByPropsLazy } from "@webpack";
import { React, RelationshipStore } from "@webpack/common"; import { React, RelationshipStore } from "@webpack/common";
const { Heading, Text } = findByPropsLazy("Heading", "Text"); const { Heading, Text } = findByPropsLazy("Heading", "Text");
// Workaround for module differing on stable & canary const container = findByPropsLazy("memberSinceWrapper");
// FIXME: remove once merged into stable
const getMemberSinceContainer = makeLazy(() => {
for (const name of ["memberSinceWrapper", "memberSinceContainer"]) {
const mod = find(filters.byProps(name), { isIndirect: true });
if (mod) return mod[name];
}
handleModuleNotFound("findByProps", "memberSinceWrapper/memberSinceContainer");
return "";
});
const { getCreatedAtDate } = findByPropsLazy("getCreatedAtDate"); const { getCreatedAtDate } = findByPropsLazy("getCreatedAtDate");
const clydeMoreInfo = findByPropsLazy("clydeMoreInfo"); const clydeMoreInfo = findByPropsLazy("clydeMoreInfo");
const locale = findByPropsLazy("getLocale"); const locale = findByPropsLazy("getLocale");
@ -59,7 +49,7 @@ export default definePlugin({
Friends Since Friends Since
</Heading> </Heading>
<div className={getMemberSinceContainer()}> <div className={container.memberSinceWrapper}>
{!!getCurrentChannel()?.guild_id && ( {!!getCurrentChannel()?.guild_id && (
<svg <svg
aria-hidden="true" aria-hidden="true"

View file

@ -198,7 +198,8 @@ export default definePlugin({
replacement: [ replacement: [
// make the tag show the right text // make the tag show the right text
{ {
match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=.{0,40}(\i\.\i\.Messages)\.BOT_TAG_BOT/, // FIXME: Remove the BOT_TAG_BOT variant when the change arrives in stable
match: /(switch\((\i)\){.+?)case (\i(?:\.\i)?)\.BOT:default:(\i)=.{0,40}(\i\.\i\.Messages)\.(?:APP_TAG|BOT_TAG_BOT)/,
replace: (_, origSwitch, variant, tags, displayedText, strings) => replace: (_, origSwitch, variant, tags, displayedText, strings) =>
`${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}], ${strings})}` `${origSwitch}default:{${displayedText} = $self.getTagText(${tags}[${variant}], ${strings})}`
}, },
@ -321,19 +322,20 @@ export default definePlugin({
isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]), isOPTag: (tag: number) => tag === Tag.Types.ORIGINAL_POSTER || tags.some(t => tag === Tag.Types[`${t.name}-OP`]),
// FIXME: Remove the BOT_TAG_BOT variants from strings when the change arrives in stable
getTagText(passedTagName: string, strings: Record<string, string>) { getTagText(passedTagName: string, strings: Record<string, string>) {
if (!passedTagName) return strings.BOT_TAG_BOT; if (!passedTagName) return strings.APP_TAG ?? strings.BOT_TAG_BOT;
const [tagName, variant] = passedTagName.split("-"); const [tagName, variant] = passedTagName.split("-");
const tag = tags.find(({ name }) => tagName === name); const tag = tags.find(({ name }) => tagName === name);
if (!tag) return strings.BOT_TAG_BOT; if (!tag) return strings.APP_TAG ?? strings.BOT_TAG_BOT;
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return strings.BOT_TAG_BOT; if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return strings.APP_TAG ?? strings.BOT_TAG_BOT;
const tagText = settings.store.tagSettings?.[tag.name]?.text || tag.displayName; const tagText = settings.store.tagSettings?.[tag.name]?.text || tag.displayName;
switch (variant) { switch (variant) {
case "OP": case "OP":
return `${strings.BOT_TAG_FORUM_ORIGINAL_POSTER}${tagText}`; return `${strings.BOT_TAG_FORUM_ORIGINAL_POSTER}${tagText}`;
case "BOT": case "BOT":
return `${strings.BOT_TAG_BOT}${tagText}`; return `${strings.APP_TAG ?? strings.BOT_TAG_BOT}${tagText}`;
default: default:
return tagText; return tagText;
} }

View file

@ -56,7 +56,7 @@ export default definePlugin({
find: ".pronouns,children", find: ".pronouns,children",
replacement: [ replacement: [
{ {
match: /{user:(\i),[^}]*,pronouns:(\i),[^}]*}=\i;/, match: /{user:(\i),[^}]*,pronouns:(\i),[^}]*}=\i.*?;(?=return)/,
replace: "$&let vcPronounSource;[$2,vcPronounSource]=$self.useProfilePronouns($1.id);" replace: "$&let vcPronounSource;[$2,vcPronounSource]=$self.useProfilePronouns($1.id);"
}, },
PRONOUN_TOOLTIP_PATCH PRONOUN_TOOLTIP_PATCH

View file

@ -94,7 +94,7 @@ export default definePlugin({
find: "renderPrioritySpeaker", find: "renderPrioritySpeaker",
replacement: [ replacement: [
{ {
match: /renderName\(\).{0,100}speaking:.{50,200}"div",{/, match: /renderName\(\).{0,100}speaking:.+?\.clanTag.+?"div",{/,
replace: "$&...$self.getVoiceProps(this.props)," replace: "$&...$self.getVoiceProps(this.props),"
} }
], ],