commit 662768ab571439abd0bc8a90a86033217ed1ce4c Author: nin0dev Date: Mon Aug 12 21:36:43 2024 -0400 added thing diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..1f7ab8b --- /dev/null +++ b/index.ts @@ -0,0 +1,118 @@ +// @ts-nocheck + +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 { Toasts, UserStore } from "@webpack/common"; +import { User } from "discord-types/general"; + +function isCurrentUser(userId: string) { + const u = UserStore.getCurrentUser().id; + return u == userId; +} + + +export default definePlugin({ + name: "ClientSideBadges", + description: "Adds client-side badges to your profile. Other users can't see them!", + authors: [Devs.nin0dev], + settings: definePluginSettings({ + discordStaff: { + type: OptionType.BOOLEAN + }, + partneredServerOwner: { + type: OptionType.BOOLEAN + }, + earlySupporter: { + type: OptionType.BOOLEAN + }, + activeDeveloper: { + type: OptionType.BOOLEAN + }, + earlyVerifiedBotDeveloper: { + type: OptionType.BOOLEAN + }, + moderatorProgramsAlumni: { + type: OptionType.BOOLEAN + }, + bugHunter: { + type: OptionType.BOOLEAN + }, + goldenBugHunter: { + type: OptionType.BOOLEAN + } + }), + async start() { + const NativeBadges: ProfileBadge[] = [ + { + description: "Discord Staff", + image: "https://cdn.discordapp.com/badge-icons/5e74e9b61934fc1f67c65515d1f7e60d.png", + position: Badges.BadgePosition.END, + shouldShow: ({ userId }) => isCurrentUser(userId), + link: "https://discord.com/company" + }, + { + description: "Partnered Server Owner", + image: "https://cdn.discordapp.com/badge-icons/3f9748e53446a137a052f3454e2de41e.png", + position: Badges.BadgePosition.END, + shouldShow: ({ userId }) => isCurrentUser(userId), + link: "https://discord.com/partners" + }, + { + description: "Early Supporter", + image: "https://cdn.discordapp.com/badge-icons/7060786766c9c840eb3019e725d2b358.png", + position: Badges.BadgePosition.END, + shouldShow: ({ userId }) => isCurrentUser(userId), + link: "https://discord.com/settings/premium" + }, + { + description: "Active Developer", + image: "https://cdn.discordapp.com/badge-icons/6bdc42827a38498929a4920da12695d9.png", + position: Badges.BadgePosition.END, + shouldShow: ({ userId }) => isCurrentUser(userId), + link: "https://support-dev.discord.com/hc/en-us/articles/10113997751447" + }, + { + description: "Early Verified Bot Developer", + image: "https://cdn.discordapp.com/badge-icons/6df5892e0f35b051f8b61eace34f4967.png", + position: Badges.BadgePosition.END, + shouldShow: ({ userId }) => isCurrentUser(userId), + link: "https://discord.com/settings/premium" + }, + { + description: "Moderator Programs Alumni", + image: "https://cdn.discordapp.com/badge-icons/fee1624003e2fee35cb398e125dc479b.png", + position: Badges.BadgePosition.END, + shouldShow: ({ userId }) => isCurrentUser(userId), + link: "https://discord.com/settings/premium" + }, + { + description: "Discord Bug Hunter", + image: "https://cdn.discordapp.com/badge-icons/2717692c7dca7289b35297368a940dd0.png", + position: Badges.BadgePosition.END, + shouldShow: ({ userId }) => isCurrentUser(userId), + link: "https://discord.com/settings/premium" + }, + { + description: "Discord Bug Hunter", + image: "https://cdn.discordapp.com/badge-icons/848f79194d4be5ff5f81505cbd0ce1e6.png", + position: Badges.BadgePosition.END, + shouldShow: ({ userId }) => isCurrentUser(userId), + link: "https://discord.com/settings/premium" + } + ]; + NativeBadges.forEach(b => Badges.addBadge(b)); + }, + async stop() { + Toasts.show({ + id: Toasts.genId(), + message: "To clear out your client-side badges, reload Discord.", + type: Toasts.Type.MESSAGE, + options: { + position: Toasts.Position.BOTTOM, // NOBODY LIKES TOASTS AT THE TOP + }, + }); + } +});