mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-27 17:05:35 +08:00
Add function for getting a list of commands
This commit is contained in:
parent
44b90612f2
commit
ce27b005f8
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user