A powerful and extendable Discord bot, with it's own module system :3
thevoid.cafe/projects/voidy
1import type { ResourceStep, ResourceStepContext } from "../../types/Step";
2import type { Resource, CommandResource } from "../../types/Resource";
3
4export const commandStep: ResourceStep = {
5 name: "command",
6
7 match(resource: Resource): boolean {
8 return resource.type === "command";
9 },
10
11 process(resource: Resource, { cache }: ResourceStepContext): Resource | null {
12 const cmd = resource as CommandResource;
13
14 if (!cmd.id || !cmd.data || !cmd.execute) {
15 console.warn(`[CommandStep] Skipping invalid command: missing id, data, or execute`);
16 return null;
17 }
18
19 cache.set("command", cmd.id, cmd);
20 return cmd;
21 },
22};