diff --git a/util/src/entities/Channel.ts b/util/src/entities/Channel.ts
index 69c08be7..1a20153c 100644
--- a/util/src/entities/Channel.ts
+++ b/util/src/entities/Channel.ts
@@ -171,7 +171,7 @@ export class Channel extends BaseClass {
if (!opts?.skipNameChecks) {
const guild = await Guild.findOneOrFail({ id: channel.guild_id });
if (!guild.features.includes("ALLOW_INVALID_CHANNEL_NAMES") && channel.name) {
- for (var character of InvisibleCharacters)
+ for (let character of InvisibleCharacters)
if (channel.name.includes(character))
throw new HTTPError("Channel name cannot include invalid characters", 403);
diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts
index 70bb41c5..328c586e 100644
--- a/util/src/entities/Guild.ts
+++ b/util/src/entities/Guild.ts
@@ -346,9 +346,9 @@ export class Guild extends BaseClass {
});
for (const channel of body.channels?.sort((a, b) => (a.parent_id ? 1 : -1))) {
- var id = ids.get(channel.id) || Snowflake.generate();
+ let id = ids.get(channel.id) || Snowflake.generate();
- var parent_id = ids.get(channel.parent_id);
+ let parent_id = ids.get(channel.parent_id);
await Channel.createChannel({ ...channel, guild_id, id, parent_id }, body.owner_id, {
keepId: true,
diff --git a/util/src/util/AutoUpdate.ts b/util/src/util/AutoUpdate.ts
index 531bd8b7..6a594fd5 100644
--- a/util/src/util/AutoUpdate.ts
+++ b/util/src/util/AutoUpdate.ts
@@ -18,7 +18,7 @@ export function enableAutoUpdate(opts: {
downloadType?: "zip";
}) {
if (!opts.checkInterval) return;
- var interval = 1000 * 60 * 60 * 24;
+ let interval = 1000 * 60 * 60 * 24;
if (typeof opts.checkInterval === "number") opts.checkInterval = 1000 * interval;
const i = setInterval(async () => {
diff --git a/util/src/util/Config.ts b/util/src/util/Config.ts
index 31b8d97c..31b0b35f 100644
--- a/util/src/util/Config.ts
+++ b/util/src/util/Config.ts
@@ -6,8 +6,8 @@ import fs from "fs";
// TODO: yaml instead of json
// const overridePath = path.join(process.cwd(), "config.json");
-var config: ConfigValue;
-var pairs: ConfigEntity[];
+let config: ConfigValue;
+let pairs: ConfigEntity[];
// TODO: use events to inform about config updates
// Config keys are separated with _
@@ -57,7 +57,7 @@ function applyConfig(val: ConfigValue) {
}
function pairsToConfig(pairs: ConfigEntity[]) {
- var value: any = {};
+ let value: any = {};
pairs.forEach((p) => {
const keys = p.key.split("_");
diff --git a/util/src/util/Database.ts b/util/src/util/Database.ts
index 9ab5d14c..f0540bdf 100644
--- a/util/src/util/Database.ts
+++ b/util/src/util/Database.ts
@@ -8,8 +8,8 @@ import { yellow, green, red } from "picocolors";
// UUID extension option is only supported with postgres
// We want to generate all id's with Snowflakes that's why we have our own BaseEntity class
-var promise: Promise<any>;
-var dbConnection: Connection | undefined;
+let promise: Promise<any>;
+let dbConnection: Connection | undefined;
let dbConnectionString = process.env.DATABASE || path.join(process.cwd(), "database.db");
export function initDatabase(): Promise<Connection> {
diff --git a/util/src/util/Permissions.ts b/util/src/util/Permissions.ts
index e5459ab5..e003bf05 100644
--- a/util/src/util/Permissions.ts
+++ b/util/src/util/Permissions.ts
@@ -5,7 +5,7 @@ import { BitField } from "./BitField";
import "missing-native-js-functions";
import { BitFieldResolvable, BitFlag } from "./BitField";
-var HTTPError: any;
+let HTTPError: any;
try {
HTTPError = require("lambert-server").HTTPError;
@@ -207,9 +207,9 @@ export async function getPermission(
} = {}
) {
if (!user_id) throw new HTTPError("User not found");
- var channel: Channel | undefined;
- var member: Member | undefined;
- var guild: Guild | undefined;
+ let channel: Channel | undefined;
+ let member: Member | undefined;
+ let guild: Guild | undefined;
if (channel_id) {
channel = await Channel.findOneOrFail({
@@ -257,7 +257,7 @@ export async function getPermission(
if (!recipient_ids?.length) recipient_ids = null;
// TODO: remove guild.roles and convert recipient_ids to recipients
- var permission = Permissions.finalPermission({
+ let permission = Permissions.finalPermission({
user: {
id: user_id,
roles: member?.roles.map((x) => x.id) || [],
diff --git a/util/src/util/Rights.ts b/util/src/util/Rights.ts
index b28c75b7..b7f45836 100644
--- a/util/src/util/Rights.ts
+++ b/util/src/util/Rights.ts
@@ -3,7 +3,7 @@ import "missing-native-js-functions";
import { BitFieldResolvable, BitFlag } from "./BitField";
import { User } from "../entities";
-var HTTPError: any;
+let HTTPError: any;
try {
HTTPError = require("lambert-server").HTTPError;
diff --git a/util/src/util/Snowflake.ts b/util/src/util/Snowflake.ts
index 134d526e..0ef178fe 100644
--- a/util/src/util/Snowflake.ts
+++ b/util/src/util/Snowflake.ts
@@ -84,10 +84,10 @@ export class Snowflake {
}
static generateWorkerProcess() { // worker process - returns a number
- var time = BigInt(Date.now() - Snowflake.EPOCH) << BigInt(22);
- var worker = Snowflake.workerId << 17n;
- var process = Snowflake.processId << 12n;
- var increment = Snowflake.INCREMENT++;
+ let time = BigInt(Date.now() - Snowflake.EPOCH) << BigInt(22);
+ let worker = Snowflake.workerId << 17n;
+ let process = Snowflake.processId << 12n;
+ let increment = Snowflake.INCREMENT++;
return BigInt(time | worker | process | increment);
}
|