diff --git a/src/structure/client/wrappers/GuildWrapper.js b/src/structure/client/wrappers/GuildWrapper.js index 7830a9d..3724320 100644 --- a/src/structure/client/wrappers/GuildWrapper.js +++ b/src/structure/client/wrappers/GuildWrapper.js @@ -242,7 +242,10 @@ class GuildWrapper { } catch (err) { await settingsMigrator.end(); await modlogsMigrator.end(); - if (!err.message.includes('No old')) this.client.logger.error(err.stack); + // Did not find old settings, marking as imported anyway + if (err.message.includes('No old')) { + await this.updateData({ _imported: { settings: true, modlogs: true } }); + } else this.client.logger.error(err.stack); return null; } await settingsMigrator.end(); diff --git a/src/structure/components/observers/GuildLogging.js b/src/structure/components/observers/GuildLogging.js index 13d6383..46d9896 100644 --- a/src/structure/components/observers/GuildLogging.js +++ b/src/structure/components/observers/GuildLogging.js @@ -85,7 +85,7 @@ class GuildLogger extends Observer { } async _logThread(thread, type) { - const { ownerId, guildWrapper: guild, parent } = thread; + const { ownerId, guildWrapper: guild } = thread; if (!this.client._built || !guild || !guild.available) return; @@ -128,8 +128,11 @@ class GuildLogger extends Observer { } } + const { parentId } = thread; + let { parent } = thread; + if (parentId && !parent) parent = await guild.resolveChannel(parentId); const embed = { - title: guild.format(`MSGLOG_THREAD_TITLE`, { action: guild.format('THREAD_SWITCH', { type }, { code: true }), channel: parent.name }), + title: guild.format(`MSGLOG_THREAD_TITLE`, { action: guild.format('THREAD_SWITCH', { type }, { code: true }), channel: parent?.name || 'Missing parent' }), description: guild.format(`MSGLOG_THREAD_DESC_${type}`, { owner: owner.tag, actor: actor?.tag || 'System', name: thread.name, id: thread.id }), footer: { text: guild.format('MSGLOG_THREAD_FOOTER', { ownerId: owner.id, channelId: parent.id, threadId: thread.id }) }, color: CONSTANTS.COLORS[`THREAD_${type}`] diff --git a/src/utilities/SettingsMigrator.js b/src/utilities/SettingsMigrator.js index a0e9dc8..0ad6a4e 100644 --- a/src/utilities/SettingsMigrator.js +++ b/src/utilities/SettingsMigrator.js @@ -259,7 +259,7 @@ class SettingsMigrator { if (automod) { - const thresholdKeys = Object.keys(result.automod?.thresholds); + const thresholdKeys = Object.keys(automod?.thresholds, {}); const thresholds = {}; for (const key of thresholdKeys) { thresholds[key] = { type: result.automod.thresholds[key].toUpperCase() };