diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-08-12 00:53:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-12 01:53:06 +0200 |
commit | c79e065d09b9a1c6c0d0db94fe60204fefc0e138 (patch) | |
tree | 1e76bd8ddcecf2552bfa6984236d1d2378802c21 | |
parent | 3b8b43c7e03f05279ea7cb8260de2631bb3a61a3 (diff) | |
download | Vencord-c79e065d09b9a1c6c0d0db94fe60204fefc0e138.tar.gz Vencord-c79e065d09b9a1c6c0d0db94fe60204fefc0e138.tar.bz2 Vencord-c79e065d09b9a1c6c0d0db94fe60204fefc0e138.zip |
ShowMeYourName: Option to use display names instead of usernames (#1634)
Co-authored-by: V <vendicated@riseup.net>
-rw-r--r-- | src/plugins/showMeYourName/index.tsx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx index 473e2f7..7123fc6 100644 --- a/src/plugins/showMeYourName/index.tsx +++ b/src/plugins/showMeYourName/index.tsx @@ -40,6 +40,11 @@ const settings = definePluginSettings({ { label: "Username only", value: "user" }, ], }, + displayNames: { + type: OptionType.BOOLEAN, + description: "Use display names in place of usernames", + default: false + }, inReplies: { type: OptionType.BOOLEAN, default: false, @@ -50,7 +55,7 @@ const settings = definePluginSettings({ export default definePlugin({ name: "ShowMeYourName", description: "Display usernames next to nicks, or no nicks at all", - authors: [Devs.dzshn], + authors: [Devs.dzshn, Devs.TheKodeToad], patches: [ { find: ".withMentionPrefix", @@ -63,9 +68,11 @@ export default definePlugin({ settings, renderUsername: ({ author, message, isRepliedMessage, withMentionPrefix }: UsernameProps) => { - if (message.interaction) return author?.nick; try { - const { username } = message.author; + let { username } = message.author; + if (settings.store.displayNames) + username = (message.author as any).globalName || username; + const { nick } = author; const prefix = withMentionPrefix ? "@" : ""; if (username === nick || isRepliedMessage && !settings.store.inReplies) |