Skip to content

Commit

Permalink
🔫 Changed require to import
Browse files Browse the repository at this point in the history
  • Loading branch information
wiki-Bird committed Aug 15, 2023
1 parent 51e4c37 commit 6974926
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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++;
Expand Down
3 changes: 2 additions & 1 deletion src/commands/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<playtimeComp.length; i++){
const heroName = playtimeComp[i].hero;
Expand Down
6 changes: 4 additions & 2 deletions src/deploy-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { Routes, RESTPostAPIApplicationCommandsJSONBody as RawSlashCommand } fro
import Command from './types/Command';
import fs from 'node:fs';

const { token } = require('../config.json');
// const { token } = require('../config.json');
import config from '../config.json';

Check failure on line 7 in src/deploy-command.ts

View workflow job for this annotation

GitHub Actions / build (16.15.1)

Cannot find module '../config.json' or its corresponding type declarations.
const { token, clientId } = config;

const commands: RawSlashCommand[] = [];
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

// Place your client and guild ids here
const clientId = '994046329678463026';
// const clientId = '994046329678463026';
// const guildId = '521856622998323202';

for (const file of commandFiles) {
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Check failure on line 16 in src/index.ts

View workflow job for this annotation

GitHub Actions / build (16.15.1)

Cannot find module '../config.json' or its corresponding type declarations.
const { token, clientId } = config;

// const myIntents = new Intents();
// myIntents.add('DIRECT_MESSAGES', 'FLAGS.GUILDS', 'MESSAGE_CONTENT', 'AUTO_MODERATION_EXECUTION','GUILD_MESSAGE_REACTIONS',
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "build"]
Expand Down

0 comments on commit 6974926

Please sign in to comment.