rojects/source/commands/Command.ts

35 lines
805 B
TypeScript

import { LocaleManager } from "../locales/LocaleManager";
import { Locales } from "../locales/Locales";
import { CommandAssignment } from "./CommandAssignments";
import { CommandContext } from "./CommandContext";
import { CommandManager } from "./CommandManager";
export abstract class Command
{
_titleLocalePath: string = "";
_infoLocalePath: string = "";
assignments: CommandAssignment[] = [];
constructor( title: string, info: string)
{
this._titleLocalePath = title;
this._infoLocalePath = info;
}
getLocalizedTitle():Promise<string>
{
return LocaleManager.$.get( this._titleLocalePath );
}
getLocalizedInfo():Promise<string>
{
return LocaleManager.$.get( this._infoLocalePath );
}
abstract execute( context: CommandContext ): Promise<void>
}