From 909726619739a1a3eaad94a6e1142bb9fc2958f4 Mon Sep 17 00:00:00 2001 From: Darius Date: Mon, 29 Sep 2025 00:55:05 +0200 Subject: [PATCH] make command registering a bit easier --- src/commands/collection.ts | 12 ++++++++---- src/util/api-functions.ts | 8 ++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/commands/collection.ts b/src/commands/collection.ts index 504e665..cb2ab4c 100644 --- a/src/commands/collection.ts +++ b/src/commands/collection.ts @@ -1,12 +1,16 @@ import { Collection } from "@discordjs/collection"; import { PingCommand } from "./impl/ping.ts"; import { SongCommand } from "./impl/song.ts"; +import { VanishCommand } from "./impl/vanish.ts"; import type { ICommand } from "./interface.ts"; export const commands = new Collection(); +const cmds: Array = []; -const songCommand = new SongCommand(); -const pingCommand = new PingCommand(); +cmds.push(new SongCommand()); +cmds.push(new PingCommand()); +cmds.push(new VanishCommand()); -commands.set(songCommand.name, songCommand); -commands.set(pingCommand.name, pingCommand); +for (const command of cmds) { + commands.set(command.name, command); +} diff --git a/src/util/api-functions.ts b/src/util/api-functions.ts index 725b12b..fa4e656 100644 --- a/src/util/api-functions.ts +++ b/src/util/api-functions.ts @@ -1,8 +1,8 @@ import type { UserIdResolvable } from "@twurple/api"; -import { Config } from "../config/config"; -import { apiClient } from "../core/api-client"; -import { getUserId } from "./general"; -import { logError } from "./logger"; +import { Config } from "../config/config.ts"; +import { apiClient } from "../core/api-client.ts"; +import { getUserId } from "./general.ts"; +import { logError } from "./logger.ts"; export async function timeoutByIds( channelId: UserIdResolvable,