make command registering a bit easier

This commit is contained in:
Darius
2025-09-29 00:55:05 +02:00
parent b22cbf160c
commit 9097266197
2 changed files with 12 additions and 8 deletions

View File

@@ -1,12 +1,16 @@
import { Collection } from "@discordjs/collection"; import { Collection } from "@discordjs/collection";
import { PingCommand } from "./impl/ping.ts"; import { PingCommand } from "./impl/ping.ts";
import { SongCommand } from "./impl/song.ts"; import { SongCommand } from "./impl/song.ts";
import { VanishCommand } from "./impl/vanish.ts";
import type { ICommand } from "./interface.ts"; import type { ICommand } from "./interface.ts";
export const commands = new Collection<string, ICommand>(); export const commands = new Collection<string, ICommand>();
const cmds: Array<ICommand> = [];
const songCommand = new SongCommand(); cmds.push(new SongCommand());
const pingCommand = new PingCommand(); cmds.push(new PingCommand());
cmds.push(new VanishCommand());
commands.set(songCommand.name, songCommand); for (const command of cmds) {
commands.set(pingCommand.name, pingCommand); commands.set(command.name, command);
}

View File

@@ -1,8 +1,8 @@
import type { UserIdResolvable } from "@twurple/api"; import type { UserIdResolvable } from "@twurple/api";
import { Config } from "../config/config"; import { Config } from "../config/config.ts";
import { apiClient } from "../core/api-client"; import { apiClient } from "../core/api-client.ts";
import { getUserId } from "./general"; import { getUserId } from "./general.ts";
import { logError } from "./logger"; import { logError } from "./logger.ts";
export async function timeoutByIds( export async function timeoutByIds(
channelId: UserIdResolvable, channelId: UserIdResolvable,