mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-15 01:49:10 +00:00
sync
This commit is contained in:
parent
7dd7c170b4
commit
86a222fb98
20 changed files with 291 additions and 46 deletions
|
@ -49,10 +49,31 @@ module.exports = (R, $) => {
|
|||
})
|
||||
|
||||
R.get('/api/auth/redirect', ctx => {
|
||||
ctx.body = { url: $.discord.getAuthUrl() }
|
||||
const url = $.discord.getAuthUrl()
|
||||
if (ctx.query.url === '✔️') {
|
||||
ctx.body = { url }
|
||||
return
|
||||
}
|
||||
|
||||
ctx.redirect(url)
|
||||
})
|
||||
|
||||
R.post('/api/auth/logout', ctx => {
|
||||
ctx.session = null
|
||||
})
|
||||
|
||||
R.get('/api/oauth/bot', ctx => {
|
||||
const url = $.discord.getBotJoinUrl()
|
||||
if (ctx.query.url === '✔️') {
|
||||
ctx.body = { url }
|
||||
return
|
||||
}
|
||||
|
||||
ctx.redirect(url)
|
||||
})
|
||||
|
||||
|
||||
R.get('/api/oauth/bot/callback', ctx => {
|
||||
console.log(ctx.request)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -67,9 +67,13 @@ module.exports = (R, $) => {
|
|||
gm = await gm.addRoles(added.filter(pred))
|
||||
}
|
||||
|
||||
if (removed.length > 0) {
|
||||
gm = await gm.removeRoles(removed.filter(pred))
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (removed.length > 0) {
|
||||
gm.removeRoles(removed.filter(pred))
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
// console.log('role patch', { added, removed, allowedRoles, addedFiltered: added.filterNot(pred), removedFiltered: removed.filterNot(pred) })
|
||||
|
||||
ctx.body = { ok: true }
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue