temp commit

This commit is contained in:
41666 2019-04-20 04:46:46 -05:00
parent e86f7ff68e
commit 6fb39d6c4d
No known key found for this signature in database
GPG key ID: BC51D07640DC10AF
22 changed files with 282 additions and 39 deletions

View file

@ -1,6 +1,5 @@
// @flow
import Eris, { type Message, type TextChannel } from 'eris'
import logger from './logger.js'
import Eris, { type Message, type TextChannel, type Guild } from 'eris'
import RPCClient from '@roleypoly/rpc-client'
import randomEmoji from './random-emoji'
import DMCommands from './commands/dm'
@ -8,6 +7,8 @@ import TextCommands from './commands/text'
import RootCommands from './commands/root'
import type { Command } from './commands/_types'
import retry from 'async-retry'
import logger from './logger'
const log = logger(__filename)
export type BotConfig = $Shape<{
@ -228,8 +229,18 @@ export default class Bot {
}
}
async syncGuild (type: string, guild: Guild) {
await this.rpc.syncGuild(type, guild.id)
}
async start () {
this.client.on('messageCreate', this.handleMessage)
const guildSyncTriggers = ['guildCreate', 'guildDelete', 'guildRoleAdd', 'guildRoleDelete', 'guildRoleUpdate']
for (const trigger of guildSyncTriggers) {
this.client.on(trigger, this.syncGuild.bind(this, trigger))
}
await this.client.connect()
log.info('started bot')
}

View file

@ -7,7 +7,6 @@
"dev": "yarn build --watch"
},
"dependencies": {
"@roleypoly/rpc-client": "2.0.0",
"async-retry": "^1.2.3",
"dotenv": "^7.0.0",
"eris": "^0.9.0"