119 lines
4.6 KiB
TypeScript
119 lines
4.6 KiB
TypeScript
// @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
|
|
},
|
|
});
|
|
}
|
|
});
|