[rpc/auth] add bot login/logout calls

This commit is contained in:
41666 2019-04-14 12:59:54 -05:00
parent e8f0579024
commit d4112c4252
No known key found for this signature in database
GPG key ID: BC51D07640DC10AF
3 changed files with 50 additions and 2 deletions

View file

@ -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
})
})