Merge branch 'dev'

pull/29/head
Matthew 2020-08-15 22:54:02 -04:00
commit 9b193abe97
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 4 additions and 2 deletions

View File

@ -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 });