diff --git a/src/api/loc.sh/routes/internal.ts b/src/api/loc.sh/routes/internal.ts index 090a02e..dd60478 100644 --- a/src/api/loc.sh/routes/internal.ts +++ b/src/api/loc.sh/routes/internal.ts @@ -14,8 +14,10 @@ export default class Internal extends Route { try { res.setHeader('Access-Control-Allow-Origin', '*'); if (req.query.id) { - const member = await this.server.client.getRESTGuildMember(this.server.client.config.guildID, req.query.id.toString()); - const pagerNumber = await this.server.client.db.PagerNumber.findOne({ individualAssignID: member.id }); + let member = this.server.client.guilds.get(this.server.client.config.guildID).members.get(req.query.id.toString()); + if (!member) member = await this.server.client.getRESTGuildMember(this.server.client.config.guildID, req.query.id.toString()); + if (!member) return res.status(404).json({ code: this.constants.codes.NOT_FOUND, message: this.constants.messages.NOT_FOUND }); + const pagerNumber = await this.server.client.db.PagerNumber.findOne({ individualAssignID: member.id }).lean().exec(); let status = false; if (member.roles.includes('446104438969466890') || member.roles.includes('701481967149121627')) status = true; return res.status(200).json({ staff: status, username: member.user.username, discriminator: member.user.discriminator, nick: member.nick, avatarURL: member.user.avatarURL, pager: pagerNumber?.num });