mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
Merge branch 'main' into BypassDND
This commit is contained in:
commit
8c93cc62ad
4 changed files with 33 additions and 14 deletions
|
@ -7,12 +7,22 @@
|
|||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getCurrentChannel } from "@utils/discord";
|
||||
import { makeLazy } from "@utils/lazy";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { filters, find, findByPropsLazy, handleModuleNotFound } from "@webpack";
|
||||
import { React, RelationshipStore } from "@webpack/common";
|
||||
|
||||
const { Heading, Text } = findByPropsLazy("Heading", "Text");
|
||||
const container = findByPropsLazy("memberSinceContainer");
|
||||
// Workaround for module differing on stable & canary
|
||||
// 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 clydeMoreInfo = findByPropsLazy("clydeMoreInfo");
|
||||
const locale = findByPropsLazy("getLocale");
|
||||
|
@ -49,7 +59,7 @@ export default definePlugin({
|
|||
Friends Since
|
||||
</Heading>
|
||||
|
||||
<div className={container.memberSinceContainer}>
|
||||
<div className={getMemberSinceContainer()}>
|
||||
{!!getCurrentChannel()?.guild_id && (
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
|
|
|
@ -50,7 +50,7 @@ export default definePlugin({
|
|||
patches: [
|
||||
// Chat Mentions
|
||||
{
|
||||
find: "CLYDE_AI_MENTION_COLOR:null,",
|
||||
find: 'location:"UserMention',
|
||||
replacement: [
|
||||
{
|
||||
match: /user:(\i),channel:(\i).{0,400}?"@"\.concat\(.+?\)/,
|
||||
|
|
|
@ -111,19 +111,28 @@ function MentionWrapper({ data, UserMention, RoleMention, parse, props }: Mentio
|
|||
|
||||
export default definePlugin({
|
||||
name: "ValidUser",
|
||||
description: "Fix mentions for unknown users showing up as '<@343383572805058560>' (hover over a mention to fix it)",
|
||||
description: "Fix mentions for unknown users showing up as '@unknown-user' (hover over a mention to fix it)",
|
||||
authors: [Devs.Ven],
|
||||
tags: ["MentionCacheFix"],
|
||||
|
||||
patches: [{
|
||||
find: 'className:"mention"',
|
||||
replacement: {
|
||||
// mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention()
|
||||
match: /react(?=\(\i,\i,\i\).{0,50}return null==\i\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/,
|
||||
// react: (...args) => OurWrapper(RoleMention, UserMention, ...args), originalReact: theirFunc
|
||||
replace: "react:(...args)=>$self.renderMention($1,$2,...args),originalReact"
|
||||
patches: [
|
||||
{
|
||||
find: 'className:"mention"',
|
||||
replacement: {
|
||||
// mention = { react: function (data, parse, props) { if (data.userId == null) return RoleMention() else return UserMention()
|
||||
match: /react(?=\(\i,\i,\i\).{0,50}return null==.{0,70}\?\(0,\i\.jsx\)\((\i\.\i),.+?jsx\)\((\i\.\i),\{className:"mention")/,
|
||||
// react: (...args) => OurWrapper(RoleMention, UserMention, ...args), originalReact: theirFunc
|
||||
replace: "react:(...args)=>$self.renderMention($1,$2,...args),originalReact"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: "unknownUserMentionPlaceholder:",
|
||||
replacement: {
|
||||
match: /unknownUserMentionPlaceholder:/,
|
||||
replace: "$&false&&"
|
||||
}
|
||||
}
|
||||
}],
|
||||
],
|
||||
|
||||
renderMention(RoleMention, UserMention, data, parse, props) {
|
||||
return (
|
||||
|
|
|
@ -92,7 +92,7 @@ if (IS_DEV && IS_DISCORD_DESKTOP) {
|
|||
}, 0);
|
||||
}
|
||||
|
||||
function handleModuleNotFound(method: string, ...filter: unknown[]) {
|
||||
export function handleModuleNotFound(method: string, ...filter: unknown[]) {
|
||||
const err = new Error(`webpack.${method} found no module`);
|
||||
logger.error(err, "Filter:", filter);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue