Skip to content

Commit

Permalink
Fix Badges
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfkid200444 committed Nov 2, 2023
1 parent 691950e commit 7779fc4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
7 changes: 7 additions & 0 deletions src/customBadges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import Badges from "./Icons";
const { React } = common;
const { Tooltip, Clickable } = components;


export enum BadgeSizes {
SIZE_24,
SIZE_22,
SIZE_18,
}

type Tooltip = React.FC<{
text?: string;
position?: "top" | "bottom" | "left" | "right";
Expand Down
16 changes: 6 additions & 10 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { User } from "discord-types/general";
import { Injector, common, webpack } from "replugged";
import { getBadges } from "./customBadges";
import { BadgeSizes, getBadges } from "./customBadges";
const { React } = common;
const inject = new Injector();

Expand Down Expand Up @@ -104,20 +104,16 @@ const cache = new Map<string, BadgeCache>();
const REFRESH_INTERVAL = 1000 * 60 * 30;

export async function start(): Promise<void> {
const mod = await webpack.waitForModule<Record<string, BadgeMod>>(
webpack.filters.bySource("getBadges()"),
);
const mod = await webpack.waitForProps<{ BadgeSizes: BadgeSizes, default: BadgeMod }>("BadgeSizes")




// eslint-disable-next-line @typescript-eslint/no-unused-vars
const fnPropName = Object.entries(mod).find(([_, v]) => typeof v === "function")?.[0];
if (!fnPropName) {
throw new Error("Could not find badges function");
}
const Badge = await getBadges();

inject.after(
mod,
fnPropName,
"default",
(
[
{
Expand Down

0 comments on commit 7779fc4

Please sign in to comment.