mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-15 18:09:09 +00:00
sync
This commit is contained in:
parent
13cd3bd4a0
commit
52cb96baa3
43 changed files with 3257 additions and 1072 deletions
|
@ -1,6 +1,25 @@
|
|||
module.exports = (R, $) => {
|
||||
R.get('/api/servers', (ctx) => {
|
||||
ctx.body = 'hi'
|
||||
console.log($)
|
||||
R.get('/api/servers', async (ctx) => {
|
||||
const { userId } = ctx.session
|
||||
const srv = $.discord.getRelevantServers(userId)
|
||||
ctx.body = $.discord.presentableServers(srv, userId)
|
||||
})
|
||||
|
||||
R.get('/api/server/:id', async (ctx) => {
|
||||
const { userId } = ctx.session
|
||||
const { id } = ctx.params
|
||||
|
||||
const srv = $.discord.client.guilds.get(id)
|
||||
|
||||
if (srv == null) {
|
||||
ctx.body = { err: 'not found' }
|
||||
ctx.status = 404
|
||||
return
|
||||
}
|
||||
|
||||
const gm = srv.members.get(userId)
|
||||
const roles = $.discord.presentableRoles(id, gm)
|
||||
|
||||
ctx.body = roles
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue