-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new plugin FullUserInChatbox (#2766)
- Loading branch information
Showing
4 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Full User In Chatbox | ||
|
||
Adds the full user mention to the textbox | ||
|
||
Adds the avatar if you have mentioned avatars enabled | ||
|
||
Provides the full context menu to make it easy to access the users profile, and other common actions | ||
|
||
https://github.com/user-attachments/assets/cd9edb33-99c8-4c8d-b669-8cddd05f4b45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Vencord, a Discord client mod | ||
* Copyright (c) 2024 Vendicated and contributors | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
import ErrorBoundary from "@components/ErrorBoundary"; | ||
import { Devs } from "@utils/constants"; | ||
import definePlugin from "@utils/types"; | ||
import { findComponentByCodeLazy } from "@webpack"; | ||
import { ReactNode } from "react"; | ||
|
||
const UserMentionComponent = findComponentByCodeLazy(".USER_MENTION)"); | ||
|
||
interface UserMentionComponentProps { | ||
id: string; | ||
channelId: string; | ||
guildId: string; | ||
OriginalComponent: ReactNode; | ||
} | ||
|
||
export default definePlugin({ | ||
name: "FullUserInChatbox", | ||
description: "Makes the user mention in the chatbox have more functionalities, like left/right clicking", | ||
authors: [Devs.sadan], | ||
|
||
patches: [ | ||
{ | ||
find: ':"text":', | ||
replacement: { | ||
match: /(hidePersonalInformation\).+?)(if\(null!=\i\){.+?return \i)(?=})/, | ||
replace: "$1return $self.UserMentionComponent({...arguments[0],OriginalComponent:(()=>{$2})()});" | ||
} | ||
} | ||
], | ||
|
||
UserMentionComponent: ErrorBoundary.wrap((props: UserMentionComponentProps) => ( | ||
<UserMentionComponent | ||
// This seems to be constant | ||
className="mention" | ||
userId={props.id} | ||
channelId={props.channelId} | ||
/> | ||
), { | ||
fallback: ({ wrappedProps }) => wrappedProps.OriginalComponent | ||
}) | ||
}); |