Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit aecee18

Browse files
committed
fix roles not populating?
1 parent 87f29ed commit aecee18

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/api/admin.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ export const admin = new Elysia({ prefix: "/admin" }).use(bearer()).guard(
6666
user.Avatar === null ||
6767
user.Roles === null
6868
) {
69-
const DiscordUser = (await DClient.users.fetch(
70-
user.DiscordiD
71-
)) as any;
69+
const DiscordUser = (await DClient.guilds.cache
70+
.find((guild) => {
71+
return guild.id === process.env.GUILD_ID;
72+
})
73+
?.members.fetch(user.DiscordiD)) as GuildMember;
7274

73-
const Roles = DiscordUser.member
75+
const Roles = DiscordUser
7476
? (
75-
DiscordUser.member.roles as GuildMemberRoleManager
77+
DiscordUser.roles as GuildMemberRoleManager
7678
).cache.map((role) => {
7779
return {
7880
id: role.id,
@@ -90,8 +92,8 @@ export const admin = new Elysia({ prefix: "/admin" }).use(bearer()).guard(
9092
DiscordiD: user.DiscordiD,
9193
},
9294
data: {
93-
Username: DiscordUser.username,
94-
GlobalName: DiscordUser.globalname,
95+
Username: DiscordUser.user.username,
96+
GlobalName: DiscordUser.user.globalName,
9597
Avatar: DiscordUser.avatar,
9698
Roles: JSON.stringify(Roles),
9799
},

0 commit comments

Comments
 (0)