performance fixes
parent
c251ccffa1
commit
91ce5bb5e8
|
@ -14,8 +14,10 @@ export default class Internal extends Route {
|
||||||
try {
|
try {
|
||||||
res.setHeader('Access-Control-Allow-Origin', '*');
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
||||||
if (req.query.id) {
|
if (req.query.id) {
|
||||||
const member = await this.server.client.getRESTGuildMember(this.server.client.config.guildID, req.query.id.toString());
|
let member = this.server.client.guilds.get(this.server.client.config.guildID).members.get(req.query.id.toString());
|
||||||
const pagerNumber = await this.server.client.db.PagerNumber.findOne({ individualAssignID: member.id });
|
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;
|
let status = false;
|
||||||
if (member.roles.includes('446104438969466890') || member.roles.includes('701481967149121627')) status = true;
|
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 });
|
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 });
|
||||||
|
|
Loading…
Reference in New Issue