diff options
author | Cynthia Foxwell <gamers@riseup.net> | 2023-08-30 17:01:29 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-31 01:01:29 +0200 |
commit | d88524e8cf3a61e3399e049f615fa5d28d66693f (patch) | |
tree | 32b1e997d8aaf27c7c426d92648302ba71e7d670 /src/plugins/showMeYourName | |
parent | d6efd99849dfc21ee3d7b077430e6e4ad76aa03e (diff) | |
download | Vencord-d88524e8cf3a61e3399e049f615fa5d28d66693f.tar.gz Vencord-d88524e8cf3a61e3399e049f615fa5d28d66693f.tar.bz2 Vencord-d88524e8cf3a61e3399e049f615fa5d28d66693f.zip |
ShowMeYourName: Fix username being wrong on slash commands (#1690)
Co-authored-by: V <vendicated@riseup.net>
Diffstat (limited to 'src/plugins/showMeYourName')
-rw-r--r-- | src/plugins/showMeYourName/index.tsx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx index 7123fc6..4ccaeea 100644 --- a/src/plugins/showMeYourName/index.tsx +++ b/src/plugins/showMeYourName/index.tsx @@ -21,13 +21,14 @@ import "./styles.css"; import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { Message } from "discord-types/general"; +import { Message, User } from "discord-types/general"; interface UsernameProps { author: { nick: string; }; message: Message; withMentionPrefix?: boolean; isRepliedMessage: boolean; + userOverride?: User; } const settings = definePluginSettings({ @@ -67,11 +68,12 @@ export default definePlugin({ ], settings, - renderUsername: ({ author, message, isRepliedMessage, withMentionPrefix }: UsernameProps) => { + renderUsername: ({ author, message, isRepliedMessage, withMentionPrefix, userOverride }: UsernameProps) => { try { - let { username } = message.author; + const user = userOverride ?? message.author; + let { username } = user; if (settings.store.displayNames) - username = (message.author as any).globalName || username; + username = (user as any).globalName || username; const { nick } = author; const prefix = withMentionPrefix ? "@" : ""; |