staff directory
parent
227a57850a
commit
c251ccffa1
|
@ -1 +1,2 @@
|
|||
export { default as root } from './root';
|
||||
export { default as internal } from './internal';
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import { Route, Server } from '../../../class';
|
||||
import acknowledgements from '../../../configs/acknowledgements.json';
|
||||
|
||||
export default class Internal extends Route {
|
||||
constructor(server: Server) {
|
||||
super(server);
|
||||
this.conf = {
|
||||
path: '/int',
|
||||
};
|
||||
}
|
||||
|
||||
public bind() {
|
||||
this.router.get('/directory', async (req, res) => {
|
||||
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 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 });
|
||||
}
|
||||
return res.status(200).json(acknowledgements);
|
||||
} catch (err) {
|
||||
return this.handleError(err, res);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue