From e991e00f325d003d68e8ac710c4ee8dfb4bdca4c Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Fri, 28 Oct 2022 15:25:58 +1100 Subject: Move src-slowcord to own repo https://github.com/MaddyUnderStars/slowcord-services --- src-slowcord/bot/src/commands/index.ts | 36 ---------------------------------- 1 file changed, 36 deletions(-) delete mode 100644 src-slowcord/bot/src/commands/index.ts (limited to 'src-slowcord/bot/src/commands/index.ts') diff --git a/src-slowcord/bot/src/commands/index.ts b/src-slowcord/bot/src/commands/index.ts deleted file mode 100644 index 0130b2bc..00000000 --- a/src-slowcord/bot/src/commands/index.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Message, GuildMember, Guild, User } from "discord.js"; -import fs from "fs"; - -export type CommandContext = { - user: User; - guild: Guild | null; - member: GuildMember | null; - message: Message; - args: string[]; -}; - -export type Command = { - name: string; - exec: (ctx: CommandContext) => any; -}; - -const walk = async (path: string) => { - const files = fs.readdirSync(path); - const out = []; - for (var file of files) { - if (fs.statSync(`${path}/${file}`).isDirectory()) continue; - if (file.indexOf("index") !== -1) continue; - if (file.indexOf(".js") !== file.length - 3) continue; - var imported = (await import(`./${file}`)).default; - out.push(imported); - } - return out; -}; - -export const getCommands = async () => { - const map: { [key: string]: Command } = {}; - for (var cmd of await walk("./build/commands")) { - map[cmd.name] = cmd; - } - return map; -}; -- cgit 1.5.1