From 8b4f33f1998dd8b894cdaa50f58610aa1ee0f4c8 Mon Sep 17 00:00:00 2001 From: Dragory Date: Mon, 19 Feb 2018 00:50:55 +0200 Subject: [PATCH] legacyMigrator: one more fix for that --- src/legacy/legacyMigrator.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/legacy/legacyMigrator.js b/src/legacy/legacyMigrator.js index 24ec71a..dd18eb9 100644 --- a/src/legacy/legacyMigrator.js +++ b/src/legacy/legacyMigrator.js @@ -81,7 +81,10 @@ async function migrateOpenThreads() { if (existingOpenThread) return; - const threadMessages = await bot.getChannel(oldThread.channelId).getMessages(1000); + const oldChannel = bot.getChannel(oldThread.channelId); + if (! oldChannel) return; + + const threadMessages = await oldChannel.getMessages(1000); const log = threadMessages.reverse().map(msg => { const date = moment.utc(msg.timestamp, 'x').format('YYYY-MM-DD HH:mm:ss'); return `[${date}] ${msg.author.username}#${msg.author.discriminator}: ${msg.content}`;