diff --git a/src/commands/interface-manager/InterfaceCommand.ts b/src/commands/interface-manager/InterfaceCommand.ts index 536c7a23..43dd00ce 100644 --- a/src/commands/interface-manager/InterfaceCommand.ts +++ b/src/commands/interface-manager/InterfaceCommand.ts @@ -102,18 +102,18 @@ export class CommandTable { } } -const COMMAND_TABLE_TABLE = new Map>(); -export function defineCommandTable(name: string) { +const COMMAND_TABLE_TABLE = new Map>(); +export function defineCommandTable(name: string|symbol) { if (COMMAND_TABLE_TABLE.has(name)) { - throw new TypeError(`A table called ${name} already exists`); + throw new TypeError(`A table called ${name.toString()} already exists`); } COMMAND_TABLE_TABLE.set(name, new CommandTable()); } -export function findCommandTable(name: string): CommandTable { +export function findCommandTable(name: string|symbol): CommandTable { const entry = COMMAND_TABLE_TABLE.get(name); if (!entry) { - throw new TypeError(`Couldn't find a table called ${name}`); + throw new TypeError(`Couldn't find a table called ${name.toString()}`); } return entry as CommandTable; } @@ -151,9 +151,15 @@ export class InterfaceCommand { } } +// Shouldn't there be a callback interface. +// imagine the old ban or sync command, each time you check a room +// you add a callback to say when a user has been banned or a room +// has been cleared or there was an error applying a ban to that room. +// There could be a description in defineInterfaceComomand +// for what each callback is and does for the adaptors to hook into. export function defineInterfaceCommand(description: { paramaters: IArgumentListParser, - table: string, + table: string|symbol, command: ExecutorType, designator: string[], summary: string,