diff --git a/src/plugins/mentionAvatars/index.tsx b/src/plugins/mentionAvatars/index.tsx index 54969314..7454e367 100644 --- a/src/plugins/mentionAvatars/index.tsx +++ b/src/plugins/mentionAvatars/index.tsx @@ -6,17 +6,25 @@ import "./styles.css"; +import { definePluginSettings } from "@api/Settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import { SelectedGuildStore, useState } from "@webpack/common"; import { User } from "discord-types/general"; +export const settings = definePluginSettings({ + hideAtSymbol: { + type: OptionType.BOOLEAN, + description: "Whether the the @-symbol should be hidden.", + default: true + } +}); + export default definePlugin({ name: "MentionAvatars", description: "Shows user avatars inside mentions", - authors: [Devs.Ven], - + authors: [Devs.Ven, Devs.Luna], patches: [{ find: ".USER_MENTION)", replacement: { @@ -24,12 +32,12 @@ export default definePlugin({ replace: "children:$self.renderUsername({username:$1,user:$2})" } }], - + settings, renderUsername: ErrorBoundary.wrap((props: { user: User, username: string; }) => { const { user, username } = props; const [isHovering, setIsHovering] = useState(false); - if (!user) return <>@{username}; + if (!user) return <>{getUsernameString(username)}; return ( setIsHovering(false)} > - @{username} + {getUsernameString(username)} ); }, { noop: true }) }); + +function getUsernameString(username: string) { + if (settings.store.hideAtSymbol) return username; + return `@${username}`; +} diff --git a/src/plugins/showHiddenChannels/index.tsx b/src/plugins/showHiddenChannels/index.tsx index 2d8b0c19..68778915 100644 --- a/src/plugins/showHiddenChannels/index.tsx +++ b/src/plugins/showHiddenChannels/index.tsx @@ -307,7 +307,7 @@ export default definePlugin({ ] }, { - find: '+1]})},"overflow"))', + find: '})},"overflow"))', replacement: [ { // Create a variable for the channel prop