Redo Settings

This commit is contained in:
thororen1234 2025-02-03 14:29:43 -05:00
parent 5ae7311746
commit a2b7336f1f
3 changed files with 378 additions and 164 deletions

176
index.tsx
View file

@ -9,169 +9,17 @@ import "./style.css";
import { ProfileBadge } from "@api/Badges";
import { Badges } from "@api/index";
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import definePlugin from "@utils/types";
import { Forms, Toasts, UserStore } from "@webpack/common";
import settings from "./settings";
function isCurrentUser(userId: string) {
const u = UserStore.getCurrentUser().id;
return u === userId;
}
const settings = definePluginSettings({
discordStaff: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Discord Staff"
},
partneredServerOwner: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Partnered Server Owner"
},
earlySupporter: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Early Supporter"
},
activeDeveloper: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Active Developer"
},
earlyVerifiedBotDeveloper: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Early Verified Bot Developer"
},
moderatorProgramsAlumni: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Moderator Programs Alumni"
},
bugHunter: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Discord Bug Hunter"
},
goldenBugHunter: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Discord Bug Hunter"
},
// shout out krystalskullofficial
// Nino missed some badges
hypesquadEvents: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "HypeSquad Events"
},
houseOfBravery: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "HypeSquad Bravery"
},
houseOfBrilliance: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "HypeSquad Briliance"
},
houseOfBalance: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "HypeSquad Balance"
},
discordQuests: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Discord Quests"
},
serverBooster: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Server Booster"
},
legacyUsername: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Legacy Username"
},
// These are badges meant for bots so idk why you would want but might as well add them
supportsCommands: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Supports Commands"
},
premiumApp: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Premium App"
},
usesAutomod: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "Uses Automod"
},
// These is a badge discord made for april fools 2024, again idk why you would want it but might as well add it
aClownForATime: {
type: OptionType.BOOLEAN,
restartNeeded: true,
description: "A clown, for a limited time"
},
nitro: {
type: OptionType.SELECT,
restartNeeded: true,
description: "Discord Nitro",
options: [
{
label: "None",
value: "none",
default: true
},
{
label: "Nitro",
value: "nitro"
},
{
label: "Bronze",
value: "bronze"
},
{
label: "Silver",
value: "silver"
},
{
label: "Gold",
value: "gold"
},
{
label: "Platinum",
value: "platinum"
},
{
label: "Diamond",
value: "diamond"
},
{
label: "Emerald",
value: "emerald"
},
{
label: "Ruby",
value: "ruby"
},
{
label: "Opal",
value: "opal"
},
]
},
});
export default definePlugin({
name: "ClientSideBadges",
description: "Adds client-side badges to your profile. Other users can't see them!",
@ -290,63 +138,63 @@ export default definePlugin({
description: "Discord Nitro",
image: "https://cdn.discordapp.com/badge-icons/2ba85e8026a8614b640c2837bcdfe21b.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "nitro",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitro,
link: "https://discord.com/settings/premium"
},
{
description: "Discord Nitro Bronze",
image: "https://cdn.discordapp.com/badge-icons/4f33c4a9c64ce221936bd256c356f91f.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "bronze",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitroBronze,
link: "https://discord.com/settings/premium"
},
{
description: "Discord Nitro Silver",
image: "https://cdn.discordapp.com/badge-icons/4514fab914bdbfb4ad2fa23df76121a6.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "silver",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitroSilver,
link: "https://discord.com/settings/premium"
},
{
description: "Discord Nitro Gold",
image: "https://cdn.discordapp.com/badge-icons/2895086c18d5531d499862e41d1155a6.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "gold",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitroGold,
link: "https://discord.com/settings/premium"
},
{
description: "Discord Nitro Platinum",
image: "https://cdn.discordapp.com/badge-icons/0334688279c8359120922938dcb1d6f8.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "platinum",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitroPlatinum,
link: "https://discord.com/settings/premium"
},
{
description: "Discord Nitro Diamond",
image: "https://cdn.discordapp.com/badge-icons/0d61871f72bb9a33a7ae568c1fb4f20a.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "diamond",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitroDiamond,
link: "https://discord.com/settings/premium"
},
{
description: "Discord Nitro Emerald",
image: "https://cdn.discordapp.com/badge-icons/11e2d339068b55d3a506cff34d3780f3.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "emerald",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitroEmerald,
link: "https://discord.com/settings/premium"
},
{
description: "Discord Nitro Ruby",
image: "https://cdn.discordapp.com/badge-icons/cd5e2cfd9d7f27a8cdcd3e8a8d5dc9f4.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "ruby",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitroRuby,
link: "https://discord.com/settings/premium"
},
{
description: "Discord Nitro Opal",
image: "https://cdn.discordapp.com/badge-icons/5b154df19c53dce2af92c9b61e6be5e2.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && settings.store.nitro === "opal",
shouldShow: ({ userId }) => isCurrentUser(userId) && !!settings.store.nitroOpal,
link: "https://discord.com/settings/premium"
},
{