clientSideBadges/index.tsx

251 lines
11 KiB
TypeScript
Raw Normal View History

2024-08-12 21:44:38 -04:00
//
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 { Forms, 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!",
2024-10-01 22:36:55 -04:00
authors: [
{ name: "KrystalSkullOfficial", id: 929208515883569182n },
Devs.nin0dev,
],
2024-08-12 21:44:38 -04:00
settingsAboutComponent: () => <>
<Forms.FormTitle style={{ color: "red", fontSize: "2rem", fontWeight: "bold" }}>Only you can view the badges. No, this can't and won't be changed.</Forms.FormTitle>
<Forms.FormText>You may need to reload Discord after editing your settings for them to apply.</Forms.FormText>
</>,
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
2024-10-01 22:36:55 -04:00
},
// shout out krystalskullofficial
// Nino missed some badges
hypesquadEvents: {
type: OptionType.BOOLEAN
},
houseOfBravery: {
type: OptionType.BOOLEAN
},
houseOfBrilliance: {
type: OptionType.BOOLEAN
},
houseOfBalance: {
type: OptionType.BOOLEAN
},
discordQuests: {
type: OptionType.BOOLEAN
},
nitro: {
type: OptionType.BOOLEAN
},
serverBooster:{
type: OptionType.BOOLEAN
},
supportsCommands:{
type: OptionType.BOOLEAN
},
2024-10-02 00:08:23 -04:00
premiumApp:{
type: OptionType.BOOLEAN
},
usesAutomod:{
type: OptionType.BOOLEAN
},
2024-10-02 00:40:47 -04:00
legacyUsername:{
2024-10-02 00:08:23 -04:00
type: OptionType.BOOLEAN
},
aClownForATime:{
type: OptionType.BOOLEAN
},
2024-08-12 21:44:38 -04:00
}),
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) && this.settings.store.discordStaff,
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) && this.settings.store.partneredServerOwner,
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) && this.settings.store.earlySupporter,
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) && this.settings.store.activeDeveloper,
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) && this.settings.store.earlyVerifiedBotDeveloper,
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) && this.settings.store.moderatorProgramsAlumni,
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) && this.settings.store.bugHunter,
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) && this.settings.store.goldenBugHunter,
link: "https://discord.com/settings/premium"
2024-10-01 22:36:55 -04:00
},
// shout out krystalskullofficial
// Nino missed some badges
{
description: "HypeSquad Events",
image: "https://cdn.discordapp.com/badge-icons/bf01d1073931f921909045f3a39fd264.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.hypesquadEvents,
link: "https://support.discord.com/hc/en-us/articles/360035962891-Profile-Badges-101#h_01GM67K5EJ16ZHYZQ5MPRW3JT3"
},
{
description: "House Of Bravery",
image: "https://cdn.discordapp.com/badge-icons/8a88d63823d8a71cd5e390baa45efa02.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.houseOfBravery,
link: "https://discord.com/settings/hypesquad-online"
},
{
description: "House Of Briliance",
image: "https://cdn.discordapp.com/badge-icons/011940fd013da3f7fb926e4a1cd2e618.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.houseOfBrilliance,
link: "https://discord.com/settings/hypesquad-online"
},
{
description: "House Of Balance",
image: "https://cdn.discordapp.com/badge-icons/3aa41de486fa12454c3761e8e223442e.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.houseOfBalance,
link: "https://discord.com/settings/hypesquad-online"
},
{
description: "Discord Quests",
image: "https://cdn.discordapp.com/badge-icons/7d9ae358c8c5e118768335dbe68b4fb8.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.discordQuests,
link: "https://discord.com/discovery/quests"
},
{
description: "Discord Nitro",
image: "https://cdn.discordapp.com/badge-icons/2ba85e8026a8614b640c2837bcdfe21b.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.nitro,
link: "https://discord.com/settings/premium"
},
{
description: "Discord 24months booster",
image: "https://cdn.discordapp.com/badge-icons/ec92202290b48d0879b7413d2dde3bab.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.serverBooster,
link: "https://discord.com/settings/premium"
},
{
description: "Supports Commands",
image: "https://cdn.discordapp.com/badge-icons/6f9e37f9029ff57aef81db857890005e.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.supportsCommands,
link: "https://discord.com/blog/welcome-to-the-new-era-of-discord-apps?ref=badge"
},
2024-10-02 00:30:28 -04:00
// these badges dont have a link because they literally dont link anywhere
2024-10-02 00:08:23 -04:00
{
description: "Premium App",
image: "https://cdn.discordapp.com/badge-icons/d2010c413a8da2208b7e4f35bd8cd4ac.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.premiumApp,
2024-10-02 00:30:28 -04:00
link: ""
2024-10-02 00:08:23 -04:00
},
{
description: "Uses Automod",
image: "https://cdn.discordapp.com/badge-icons/f2459b691ac7453ed6039bbcfaccbfcd.png",
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.usesAutomod,
link: ""
},
{
2024-10-02 00:40:47 -04:00
description: "Legacy Username",
2024-10-02 00:08:23 -04:00
image: "https://cdn.discordapp.com/badge-icons/6de6d34650760ba5551a79732e98ed60.png",
position: Badges.BadgePosition.END,
2024-10-02 00:40:47 -04:00
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.legacyUsernames,
2024-10-02 00:08:23 -04:00
link: ""
},
2024-10-02 00:40:47 -04:00
// Im linking to a dicord video about lootboxs incase someone doesnt know the context behind this badge
2024-10-02 00:08:23 -04:00
{
description: "A clown, for a limited time",
2024-10-02 00:28:07 -04:00
image: "https://discord.com/assets/971cfe4aa5c0582000ea.svg",
2024-10-02 00:08:23 -04:00
position: Badges.BadgePosition.END,
shouldShow: ({ userId }) => isCurrentUser(userId) && this.settings.store.aClownForATime,
2024-10-02 00:28:07 -04:00
link: "https://youtu.be/cc2-4ci4G84"
2024-10-02 00:08:23 -04:00
},
2024-08-12 21:44:38 -04:00
];
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
},
});
}
});