legacyMigrator: possible fix for last commit

master
Dragory 2018-02-19 00:49:44 +02:00
parent a76a675f4c
commit 8a1b8802b3
1 changed files with 36 additions and 30 deletions

View File

@ -69,9 +69,11 @@ async function shouldMigrate() {
async function migrateOpenThreads() {
const bot = new Eris.Client(config.token);
await bot.connect();
return new Promise(resolve => {
bot.on('ready', async () => {
const oldThreads = await jsonDb.get('threads', []);
const promises = oldThreads.map(async oldThread => {
const existingOpenThread = await knex('threads')
.where('channel_id', oldThread.channelId)
@ -106,7 +108,11 @@ async function migrateOpenThreads() {
});
});
return Promise.all(promises);
resolve(Promise.all(promises));
});
bot.connect();
});
}
async function migrateLogs() {