mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-17 02:29:10 +00:00
[rpc/auth] add bot login/logout calls
This commit is contained in:
parent
e8f0579024
commit
d4112c4252
3 changed files with 50 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
// @flow
|
||||
import { type AppContext } from '../Roleypoly'
|
||||
import { type Context } from 'koa'
|
||||
import { bot } from './_security'
|
||||
|
||||
export default ($: AppContext) => ({
|
||||
async checkAuthChallenge (ctx: Context, text: string): Promise<boolean> {
|
||||
|
@ -12,5 +13,18 @@ export default ($: AppContext) => ({
|
|||
$.auth.injectSessionFromChallenge(ctx, chall)
|
||||
$.auth.deleteDMChallenge(chall)
|
||||
return true
|
||||
}
|
||||
},
|
||||
|
||||
issueAuthChallenge: bot($, (ctx: Context, userId: string) => {
|
||||
return $.discord.issueChallenge(userId)
|
||||
}),
|
||||
|
||||
botPing: bot($, () => {
|
||||
return true
|
||||
}),
|
||||
|
||||
removeUserSessions: bot($, async (ctx: Context, userId: string) => {
|
||||
await $.auth.clearUserSessions(userId)
|
||||
return true
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue