Skip to content

Commit

Permalink
Fix Badges not showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolfkid200444 committed Apr 27, 2023
1 parent dc7f927 commit 9082eed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"discordID": "347096063569559553",
"github": "WolfPlugs"
},
"version": "1.2.5",
"version": "1.2.6",
"updater": {
"type": "github",
"id": "WolfPlugs/GlobalBadges"
Expand Down
15 changes: 7 additions & 8 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface BadgeArgs {
}

type BadgeMod = (args: BadgeArgs) => React.ReactElement<{
children: React.ReactElement[][];
children: React.ReactElement[];
className: string;
}>;

Expand Down Expand Up @@ -97,7 +97,7 @@ const REFRESH_INTERVAL = 1000 * 60 * 30;

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

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand All @@ -119,7 +119,7 @@ export async function start(): Promise<void> {
res,
) => {
const [badges, setBadges] = React.useState<CustomBadges | null>(null);

console.log(res);
React.useEffect(() => {
(async () => {
await fetchBadges(id, setBadges);
Expand All @@ -132,12 +132,11 @@ export async function start(): Promise<void> {
string,
string
>;
const firstChild = res.props.children[0];
if (!firstChild) return res;

res.props.children[0] = [...firstChild, ...getBadgeselements(badges, Badge, id)];
const theChildren = res?.props?.children;
if (!theChildren) return res;
res.props.children = [...theChildren, ...getBadgeselements(badges, Badge, id)];

if (firstChild.length > 0) {
if (theChildren.length > 0) {
if (!res.props.className.includes(containerWithContent)) {
res.props.className += ` ${containerWithContent}`;
}
Expand Down

0 comments on commit 9082eed

Please sign in to comment.