diff --git a/src/classes/Bot.ts b/src/classes/Bot.ts index c8f0a4570..7e1683ed0 100644 --- a/src/classes/Bot.ts +++ b/src/classes/Bot.ts @@ -948,7 +948,7 @@ export default class Bot { let promise = Promise.resolve(); - return new Promise(async (resolve, reject) => { + return new Promise((resolve, reject) => { const checkIfStopping = () => { if (this.botManager.isStopping) return reject(); }; diff --git a/src/classes/BotManager.ts b/src/classes/BotManager.ts index 60a2aaa1b..7f84b33f9 100644 --- a/src/classes/BotManager.ts +++ b/src/classes/BotManager.ts @@ -60,32 +60,28 @@ export default class BotManager { } }); - return new Promise(async (resolve, reject) => { - try { - log.debug('Connecting to PM2...'); - await this.connectToPM2(); + try { + log.debug('Connecting to PM2...'); + await this.connectToPM2(); - log.info('Starting bot...'); - this.pricer.init(options.enableSocket); - this.bot = new Bot(this, options, this.pricer); + log.info('Starting bot...'); + this.pricer.init(options.enableSocket); + this.bot = new Bot(this, options, this.pricer); - await this.bot.start(); + await this.bot.start(); - this.pricer.connect(this.bot?.options.enableSocket); + this.pricer.connect(this.bot?.options.enableSocket); - this.schemaManager = this.bot.schemaManager; - - resolve(); - } catch (err) { - if (this.isStopping) { - return resolve(this.stop(null, false, false)); - } + this.schemaManager = this.bot.schemaManager; + } catch (err) { + if (this.isStopping) { + return Promise.resolve(this.stop(null, false, false)); + } - if (err) { - reject(err); - } + if (err) { + throw err; } - }); + } } stop(err: Error | null, checkIfReady = true, rudely = false): void {