mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-17 17:34:39 +01:00
Add function for getting a list of commands
This commit is contained in:
@@ -6,12 +6,20 @@ import { Quality, ItemType } from "@backend/types";
|
|||||||
import type { Command, Avatar, Item } from "@backend/types";
|
import type { Command, Avatar, Item } from "@backend/types";
|
||||||
|
|
||||||
type AvatarDump = { [key: number]: Avatar };
|
type AvatarDump = { [key: number]: Avatar };
|
||||||
|
type CommandDump = { [key: string]: Command };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches and casts all commands in the file.
|
* Fetches and casts all commands in the file.
|
||||||
*/
|
*/
|
||||||
export function getCommands(): { [key: string]: Command } {
|
export function getCommands(): CommandDump {
|
||||||
return commands as { [key: string]: Command };
|
return commands as CommandDump;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches and lists all the commands in the file.
|
||||||
|
*/
|
||||||
|
export function listCommands(): Command[] {
|
||||||
|
return Object.values(getCommands());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user