Skip to content

Commit 624d604

Browse files
committed
refactor: switch to .ts imports for some HidenCloud requirements
1 parent 55fd528 commit 624d604

40 files changed

Lines changed: 120 additions & 101 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
.env
3-
data/
3+
data/
4+
dist/

src/commands/!misc/premium.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { SubcommandCallbackOpts } from "../../types/command.js";
2-
import { cacheDB, getCachedDB } from "../../utils/cacheDB.js";
3-
import { createDocument, deleteDocument } from "../../utils/firestore.js";
1+
import type { SubcommandCallbackOpts } from "../../types/command.ts";
2+
import { cacheDB, getCachedDB } from "../../utils/cacheDB.ts";
3+
import { createDocument, deleteDocument } from "../../utils/firestore.ts";
44

55
export default {
66
name: "premium",

src/commands/!misc/refreshdb.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { CommandCallbackOpts } from "../../types/command.js";
2-
import { cacheDB } from "../../utils/cacheDB.js";
1+
import type { CommandCallbackOpts } from "../../types/command.ts";
2+
import { cacheDB } from "../../utils/cacheDB.ts";
33

44
export default {
55
name: "refreshdb",

src/commands/!mod/ban.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EmbedBuilder } from "discord.js";
2-
import type { CommandCallbackOpts } from "../../types/command.js";
3-
import { createDocument } from "../../utils/firestore.js";
4-
import getConfig from "../../utils/getConfig.js";
2+
import type { CommandCallbackOpts } from "../../types/command.ts";
3+
import { createDocument } from "../../utils/firestore.ts";
4+
import getConfig from "../../utils/getConfig.ts";
55

66
export default {
77
name: "ban",

src/commands/!mod/checkban.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EmbedBuilder } from "discord.js";
2-
import type { CommandCallbackOpts } from "../../types/command.js";
3-
import { getDocument } from "../../utils/firestore.js";
2+
import type { CommandCallbackOpts } from "../../types/command.ts";
3+
import { getDocument } from "../../utils/firestore.ts";
44

55
export default {
66
name: "checkban",

src/commands/!mod/unban.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EmbedBuilder } from "discord.js";
2-
import type { CommandCallbackOpts } from "../../types/command.js";
3-
import { deleteDocument } from "../../utils/firestore.js";
4-
import getConfig from "../../utils/getConfig.js";
2+
import type { CommandCallbackOpts } from "../../types/command.ts";
3+
import { deleteDocument } from "../../utils/firestore.ts";
4+
import getConfig from "../../utils/getConfig.ts";
55

66
export default {
77
name: "unban",

src/commands/!stats/stats.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EmbedBuilder } from "discord.js";
2-
import type { CommandCallbackOpts } from "../../types/command.js";
3-
import { getServerStats, getStats } from "../../utils/stats.js";
2+
import type { CommandCallbackOpts } from "../../types/command.ts";
3+
import { getServerStats, getStats } from "../../utils/stats.ts";
44

55
export default {
66
name: "stats",
@@ -9,8 +9,10 @@ export default {
99
devOnly: true,
1010
async callback({ client, message, args }: CommandCallbackOpts) {
1111
try {
12-
if (args[0]) {
13-
const serverStats = await getServerStats(args[0] || message.guildId);
12+
if (args[0] || message.guildId) {
13+
const serverStats = await getServerStats(
14+
(args[0] || message.guildId) ?? "",
15+
);
1416
if (!serverStats) {
1517
return message.reply({
1618
embeds: [
@@ -54,7 +56,7 @@ export default {
5456
return message.reply({ embeds: [serverEmbed] });
5557
}
5658
const stats = await getStats();
57-
const serverStats = await getServerStats(message.guildId);
59+
const serverStats = await getServerStats(message.guildId ?? "");
5860

5961
const globalData = stats.global || {};
6062
const commandsData = stats.commands || {};
@@ -87,7 +89,9 @@ export default {
8789
);
8890

8991
// Most used commands embed
90-
const sortedCommands = Object.entries(commandsData)
92+
const sortedCommands = Object.entries(
93+
commandsData as Record<string, number>,
94+
)
9195
.sort((a, b) => b[1] - a[1])
9296
.slice(0, 10);
9397

src/commands/code/complexity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { EmbedBuilder } from "discord.js";
2-
import type { CommandCallbackOpts } from "../../types/command.js";
2+
import type { CommandCallbackOpts } from "../../types/command.ts";
33
import {
44
parseCodeBlock,
55
parseCodeCommandInput,
6-
} from "../../utils/codeInput.js";
6+
} from "../../utils/codeInput.ts";
77

88
export default {
99
name: "complexity",

src/commands/code/format.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { EmbedBuilder, codeBlock } from "discord.js";
22
import prettier from "prettier";
3-
import type { CommandCallbackOpts } from "../../types/command.js";
3+
import type { CommandCallbackOpts } from "../../types/command.ts";
44
import {
55
parseCodeBlock,
66
parseCodeCommandInput,
7-
} from "../../utils/codeInput.js";
8-
import getConfig from "../../utils/getConfig.js";
7+
} from "../../utils/codeInput.ts";
8+
import getConfig from "../../utils/getConfig.ts";
99

1010
const parserMap: Record<string, string> = {
1111
js: "babel",

src/commands/code/run.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import {
88
} from "discord.js";
99
import "dotenv/config";
1010
import { Groq } from "groq-sdk";
11-
import type { CommandCallbackOpts } from "../../types/command.js";
11+
import type { CommandCallbackOpts } from "../../types/command.ts";
1212
import {
1313
parseCodeBlock,
1414
parseCodeCommandInput,
15-
} from "../../utils/codeInput.js";
16-
import getConfig from "../../utils/getConfig.js";
15+
} from "../../utils/codeInput.ts";
16+
import getConfig from "../../utils/getConfig.ts";
1717

1818
const groq = new Groq({ apiKey: process.env.GROQ_API_KEY });
1919

0 commit comments

Comments
 (0)