This commit is contained in:
41666 2017-12-10 03:56:41 -06:00
parent 13cd3bd4a0
commit 52cb96baa3
43 changed files with 3257 additions and 1072 deletions

View file

@ -6,9 +6,21 @@ module.exports = (R, $) => {
return
})
R.get('/api/~/roles/:server', (ctx, next) => {
R.get('/api/~/roles/:id/:userId', (ctx, next) => {
// ctx.body = 'ok'
ctx.body = $.discord.getRoles(ctx.params.server)
return
const { id, userId } = ctx.params
const srv = $.discord.client.guilds.get(id)
if (srv === undefined) {
ctx.body = { err: 'not found' }
ctx.status = 404
return
}
const gm = srv.members.get(userId)
const roles = $.discord.presentableRoles(id, gm)
ctx.boy = roles
})
}