This commit is contained in:
Erik 2022-09-01 09:58:22 +03:00
parent 376d3520d2
commit c569520ad0
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
3 changed files with 10 additions and 4 deletions

View File

@ -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();

View File

@ -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}`]

View File

@ -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() };