diff --git a/src/commands/config.ts b/src/commands/config.ts index 0d7bff2..a519276 100644 --- a/src/commands/config.ts +++ b/src/commands/config.ts @@ -212,7 +212,7 @@ const config: Command = { .setColor("#bee2ff"); if (otterChannels.exists()) { let i = 1; - for (const [key, value] of Object.entries(otterChannels.val())) { + for (const [key] of Object.entries(otterChannels.val())) { embed.addFields({ name: `Channel #${i}`, value: `<#${key}>` }) i++; } @@ -259,7 +259,7 @@ const config: Command = { // Decrement the key of every element after the removed one await rulesRef.once("value", (snapshot) => { const data = snapshot.val(); - const newData: {[key: string]: any} = {}; // add index signature here + const newData: {[key: string]: unknown} = {}; // add index signature here for (const key in data) { if (parseInt(key) < rule) { @@ -295,7 +295,7 @@ const config: Command = { .setColor("#00f2ff"); if (rules.exists()) { let i = 1; - for (const [key, value] of Object.entries(rules.val())) { + for (const [, value] of Object.entries(rules.val())) { const ruleText: string = value as string; embed.addFields({ name: `Rule #${i}`, value: ruleText }); i++; @@ -372,7 +372,7 @@ const config: Command = { .setColor("#00f2ff"); if (words.exists()) { let i = 1; - for (const [key, value] of Object.entries(words.val())) { + for (const [, value] of Object.entries(words.val())) { const wordText: string = value as string; embed.addFields({name: `Word #${i}`, value: wordText}); i++; diff --git a/src/commands/stats.ts b/src/commands/stats.ts index d8f897d..ecb9866 100644 --- a/src/commands/stats.ts +++ b/src/commands/stats.ts @@ -295,7 +295,8 @@ const stats: Command = { // best hero is the one with the highest winrate * playtime // get the highest winrate * playtime, knowing that .played and .win_rate are not in the same order // start by saving things like this: "hero1": [winrateComp, winrateQP, playtimeComp, playtimeQP] - const heroStats: heroStats = new Object(); + const heroStats = new Object() as heroStats; + for (let i=0; i file.endsWith('.js')); // Place your client and guild ids here -const clientId = '994046329678463026'; +// const clientId = '994046329678463026'; // const guildId = '521856622998323202'; for (const file of commandFiles) { diff --git a/src/index.ts b/src/index.ts index c221a75..9946dec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,8 +10,11 @@ import { REST } from '@discordjs/rest'; import { Routes } from 'discord-api-types/v9'; // const express = require('express'); -const { token } = require('../config.json'); -const { clientId } = require('../config.json'); +// const { token } = require('../config.json'); +// const { clientId } = require('../config.json'); + +import config from '../config.json'; +const { token, clientId } = config; // const myIntents = new Intents(); // myIntents.add('DIRECT_MESSAGES', 'FLAGS.GUILDS', 'MESSAGE_CONTENT', 'AUTO_MODERATION_EXECUTION','GUILD_MESSAGE_REACTIONS', diff --git a/tsconfig.json b/tsconfig.json index e454a2e..89ccebe 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,8 @@ "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "skipLibCheck": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "allowSyntheticDefaultImports": true }, "include": ["src/**/*"], "exclude": ["node_modules", "build"]