Plugin
FullUserInChatbox
Makes the user mention in the chatbox have more functionalities, like left/right clicking
1
import ErrorBoundary from "@components/ErrorBoundary";2
import { Devs } from "@utils/constants";3
import definePlugin from "@utils/types";4
import { findComponentByCodeLazy } from "@webpack";5
import { UserStore, useStateFromStores } from "@webpack/common";6
import { ReactNode } from "react";7
8
const UserMentionComponent = findComponentByCodeLazy(".USER_MENTION)");9
10
interface UserMentionComponentProps {11
id: string;12
channelId: string;13
guildId: string;14
originalComponent: () => ReactNode;15
}16
17
export default definePlugin({18
name: "FullUserInChatbox",19
description: "Makes the user mention in the chatbox have more functionalities, like left/right clicking",20
tags: ["Shortcuts", "Utility"],21
authors: [Devs.sadan],22
23
patches: [24
{25
// Same find as RoleColorEverywhere chatbox mentions26
find: 039;"text":"locked"039;,27
replacement: {28
match: /(hidePersonalInformation\).+?)(if\(null!=\i\){.+?return \i)(?=})/,29
replace: "$1return $self.UserMentionComponent({...arguments[0],originalComponent:()=>{$2}});"30
}31
}32
],33
34
UserMentionComponent: ErrorBoundary.wrap((props: UserMentionComponentProps) => {35
const user = useStateFromStores([UserStore], () => UserStore.getUser(props.id));36
if (user == null) {37
return props.originalComponent();38
}39
40
return <UserMentionComponent41
// This seems to be constant42
className="mention"43
userId={props.id}44
channelId={props.channelId}45
/>;46
}, {47
fallback: ({ wrappedProps: { originalComponent } }) => originalComponent()48
})49
});50