v1/packages/roleypoly-bot/commands/root.js
2019-04-14 13:00:27 -05:00

30 lines
781 B
JavaScript

// @flow
import type { Command } from './_types'
import type Bot from '../Bot'
import type { Message } from 'eris'
import { withTyping } from '../utils'
const cmds: Command[] = [
{
regex: /^remove sessions for/,
usage: 'remove sessions for <mention>',
description: 'removes all sessions for a given user.',
handler: withTyping(async (bot: Bot, msg: Message) => {
const u = msg.mentions[0]
await bot.rpc.removeUserSessions(u.id)
return `${u.mention} should no longer be logged in on any device.`
})
},
{
regex: /^always error/,
usage: 'always error',
description: 'creates an error',
handler: () => {
throw new Error('not an error, this is actually a success.')
}
}
]
export default new Set<Command>(cmds)