better platformindicators settings (#243)

This commit is contained in:
megumin 2022-11-21 19:12:46 +00:00 committed by GitHub
parent 0f7c80fd4d
commit 31ec1ec1b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"
}
]
},
}
});