Reformat code
diff --git a/src/utils/database.ts b/src/utils/database.ts
index c46a39d..89c108b 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -55,7 +55,7 @@
} catch (e) {
guildObj = null;
}
- if(!guildObj) await this.delete(guild.id);
+ if (!guildObj) await this.delete(guild.id);
}
}
@@ -251,8 +251,13 @@
.replace(/\//g, "_")
.replace(/\+/g, "-")
.substring(0, 32);
- const iv = getIV().toString("base64").substring(0, 16).replace(/=/g, "").replace(/\//g, "_").replace(/\+/g, "-");
- console.log(iv);
+ const iv = getIV()
+ .toString("base64")
+ .substring(0, 16)
+ .replace(/=/g, "")
+ .replace(/\//g, "_")
+ .replace(/\+/g, "-");
+ console.log(iv);
for (const message of transcript.messages) {
if (message.content) {
const encCipher = crypto.createCipheriv("AES-256-CBC", key, iv);
@@ -321,10 +326,10 @@
}
async read(code: string, key: string, iv: string) {
- console.log("Transcript read")
+ console.log("Transcript read");
let doc: TranscriptSchema | null = await this.transcripts.findOne({ code: code });
let findDoc: findDocSchema | null = null;
- console.log(doc)
+ console.log(doc);
if (!doc) findDoc = await this.messageToTranscript.findOne({ transcript: code });
if (findDoc) {
const message = await (
@@ -350,7 +355,7 @@
if (!data) return null;
doc = JSON.parse(Buffer.from(data).toString()) as TranscriptSchema;
}
- console.log(doc)
+ console.log(doc);
if (!doc) return null;
for (const message of doc.messages) {
if (message.content) {
@@ -406,8 +411,8 @@
topRole: {
color: message.member ? message.member.roles.highest.color : 0x000000
},
- iconURL: (message.member?.user || message.author)?.displayAvatarURL({ forceStatic: true }),
- bot: message.author?.bot || false
+ iconURL: (message.member?.user || message.author).displayAvatarURL({ forceStatic: true }),
+ bot: message.author.bot || false
},
createdTimestamp: message.createdTimestamp
};
diff --git a/src/utils/log.ts b/src/utils/log.ts
index f1c03ef..b29f365 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -4,7 +4,7 @@
import { promisify } from "util";
import generateKeyValueList from "./generateKeyValueList.js";
import client from "./client.js";
-import {DiscordAPIError} from "discord.js";
+import { DiscordAPIError } from "discord.js";
const wait = promisify(setTimeout);
@@ -44,12 +44,12 @@
return `${user.username} [<@${user.id}>]`;
},
renderTime(t: number) {
- if(isNaN(t)) return "Unknown"
+ if (isNaN(t)) return "Unknown";
t = Math.floor((t /= 1000));
return `<t:${t}:D> at <t:${t}:T>`;
},
renderDelta(t: number) {
- if(isNaN(t)) return "Unknown"
+ if (isNaN(t)) return "Unknown";
t = Math.floor((t /= 1000));
return `<t:${t}:R> (<t:${t}:D> at <t:${t}:T>)`;
},
diff --git a/src/utils/migration/migration.ts b/src/utils/migration/migration.ts
index 0f54724..6286465 100644
--- a/src/utils/migration/migration.ts
+++ b/src/utils/migration/migration.ts
@@ -1,18 +1,20 @@
-import * as fs from 'fs';
+import * as fs from "fs";
import client from "../client.js";
import _ from "lodash";
-const dir = './data';
+const dir = "./data";
const files = fs.readdirSync(dir);
for (const file of files) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let rsmData: any;
try {
- rsmData = JSON.parse(fs.readFileSync(`${dir}/${file}`, 'utf8'));
- } catch { continue }
+ rsmData = JSON.parse(fs.readFileSync(`${dir}/${file}`, "utf8"));
+ } catch {
+ continue;
+ }
if (!rsmData.version || rsmData.version < 3) continue;
- const nucleusData = await client.database.guilds.readOld(rsmData.guild_info.id)
+ const nucleusData = await client.database.guilds.readOld(rsmData.guild_info.id);
const rsmToNucleus = {
id: rsmData.guild_info.id,
version: 1,
@@ -20,54 +22,54 @@
filters: {
images: {
NSFW: rsmData.images?.nsfw,
- size: rsmData.images?.toosmall,
+ size: rsmData.images?.toosmall
},
malware: null,
wordFilter: {
enabled: true,
words: {
strict: rsmData.wordfilter?.strict,
- loose: rsmData.wordfilter?.soft,
+ loose: rsmData.wordfilter?.soft
},
allowed: {
users: rsmData.wordfilter?.ignore?.members,
roles: rsmData.wordfilter?.ignore?.roles,
- channels: rsmData.wordfilter?.ignore?.channels,
- },
+ channels: rsmData.wordfilter?.ignore?.channels
+ }
},
invite: {
enabled: rsmData.invite?.enabled,
allowed: {
channels: rsmData.invite?.whitelist?.members,
roles: rsmData.invite?.whitelist?.roles,
- users: rsmData.invite?.whitelist?.channels,
- },
+ users: rsmData.invite?.whitelist?.channels
+ }
}
},
welcome: {
enabled: true,
role: rsmData.welcome?.role,
channel: rsmData.welcome?.message?.channel,
- message: rsmData.welcome?.message?.text ?? null,
+ message: rsmData.welcome?.message?.text ?? null
},
logging: {
logs: {
enabled: true,
- channel: rsmData.log_info?.log_channel,
+ channel: rsmData.log_info?.log_channel
},
staff: {
- channel: rsmData.log_info?.staff,
+ channel: rsmData.log_info?.staff
}
},
verify: {
enabled: true,
- role: rsmData.verify_role,
+ role: rsmData.verify_role
},
tickets: {
enabled: true,
category: rsmData.modmail?.cat,
supportRole: rsmData.modmail?.mention,
- maxTickets: rsmData.modmail?.max,
+ maxTickets: rsmData.modmail?.max
},
tags: rsmData.tags
} as Partial<ReturnType<typeof client.database.guilds.read>>;
@@ -75,5 +77,4 @@
const merged = _.merge(nucleusData, rsmToNucleus);
// console.log(merged)
await client.database.guilds.write(merged.id!, merged);
-
}