Add function for getting a list of commands

This commit is contained in:
KingRainbow44 2023-04-06 22:30:34 -04:00
parent 44b90612f2
commit ce27b005f8
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE

View File

@ -6,12 +6,20 @@ import { Quality, ItemType } from "@backend/types";
import type { Command, Avatar, Item } from "@backend/types";
type AvatarDump = { [key: number]: Avatar };
type CommandDump = { [key: string]: Command };
/**
* Fetches and casts all commands in the file.
*/
export function getCommands(): { [key: string]: Command } {
return commands as { [key: string]: Command };
export function getCommands(): CommandDump {
return commands as CommandDump;
}
/**
* Fetches and lists all the commands in the file.
*/
export function listCommands(): Command[] {
return Object.values(getCommands());
}
/**