From 31ec1ec1b4c031ffd0a22bfdc4c2678c19a9ca7e Mon Sep 17 00:00:00 2001 From: megumin Date: Mon, 21 Nov 2022 19:12:46 +0000 Subject: [PATCH] better platformindicators settings (#243) --- src/plugins/platformIndicators.tsx | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/plugins/platformIndicators.tsx b/src/plugins/platformIndicators.tsx index 9a9a1ab..2917ba8 100644 --- a/src/plugins/platformIndicators.tsx +++ b/src/plugins/platformIndicators.tsx @@ -98,6 +98,7 @@ export default definePlugin({ { // Server member list decorators find: "this.renderPremium()", + predicate: () => ["both", "list"].includes(Settings.plugins.PlatformIndicators.displayMode), replacement: { match: /this.renderPremium\(\)[^\]]*?\]/, replace: "$&.concat(Vencord.Plugins.plugins.PlatformIndicators.renderPlatformIndicators(this.props))" @@ -106,6 +107,7 @@ export default definePlugin({ { // Dm list decorators find: "PrivateChannel.renderAvatar", + predicate: () => ["both", "list"].includes(Settings.plugins.PlatformIndicators.displayMode), replacement: { match: /(subText:(.{1,3})\..+?decorators:)(.+?:null)/, replace: "$1[$3].concat(Vencord.Plugins.plugins.PlatformIndicators.renderPlatformIndicators($2.props))" @@ -114,7 +116,7 @@ export default definePlugin({ { // User badges find: "Messages.PROFILE_USER_BADGES", - predicate: () => Settings.plugins.PlatformIndicators.showAsBadges, + predicate: () => ["both", "badges"].includes(Settings.plugins.PlatformIndicators.displayMode), replacement: { match: /(Messages\.PROFILE_USER_BADGES,role:"group",children:)(.+?\.key\)\}\)\))/, replace: "$1[Vencord.Plugins.plugins.PlatformIndicators.renderPlatformIndicators(e)].concat($2)" @@ -129,11 +131,25 @@ export default definePlugin({ ), options: { - showAsBadges: { - description: "Show platform icons in user badges", - type: OptionType.BOOLEAN, - default: true, + displayMode: { + type: OptionType.SELECT, + description: "Where to display the platform indicators", restartNeeded: true, - } + options: [ + { + label: "Member List & Badges", + value: "both", + default: true + }, + { + label: "Member List Only", + value: "list" + }, + { + label: "Badges Only", + value: "badges" + } + ] + }, } });