From a6f8330f3f3492beb68d88b31c7d98a387d90448 Mon Sep 17 00:00:00 2001 From: Will Hunt <will@half-shot.uk> Date: Sat, 9 Feb 2019 00:47:34 +0000 Subject: [PATCH] Fix dependency fail with userStore --- src/bot.ts | 3 ++- src/discordas.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bot.ts b/src/bot.ts index b506318..74b050b 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -97,7 +97,6 @@ export class DiscordBot { new MatrixEventProcessorOpts(this.config, this.bridge, this), ); this.channelSync = new ChannelSyncroniser(this.bridge, this.config, this); - this.userSync = new UserSyncroniser(this.bridge, this.config, this); // init vars this.sentMessages = []; @@ -137,6 +136,8 @@ export class DiscordBot { public async init(): Promise<void> { await this.store.init(); + // This uses userStore which needs to be accessed after the bridge has started. + this.userSync = new UserSyncroniser(this.bridge, this.config, this); await this.clientFactory.init(); } diff --git a/src/discordas.ts b/src/discordas.ts index 49f2ebf..bf15c03 100644 --- a/src/discordas.ts +++ b/src/discordas.ts @@ -148,8 +148,8 @@ async function run(port: number, fileConfig: DiscordBridgeConfig) { try { log.info("Initing store."); - await discordbot.init(); await bridge.run(port, config); + await discordbot.init(); log.info(`Started listening on port ${port}.`); log.info("Initing bot."); await discordbot.run(); -- GitLab