diff --git a/src/command.ts b/src/command.ts index c5c6b3c..e8f3d85 100644 --- a/src/command.ts +++ b/src/command.ts @@ -33,6 +33,8 @@ export function send_message({ msg, sender }: { msg: string; sender: string; }, }); } +let disabled_commands: Map = new Map(); + export function run_command(cmd_raw: string, uid: string, users: Map, io: SocketServer, silent: boolean = false) { const cmd = cmd_raw.replace(/(^\s*)|(\s*$)/, ''); @@ -173,6 +175,18 @@ export function run_command(cmd_raw: string, uid: string, users: Map { + const target_command = cmd_set[1]; + disabled_commands.delete(target_command); + command_reply('Enabled.'); + }); + + admin_command_map.set('disable', () => { + const target_command = cmd_set[1]; + disabled_commands.set(target_command, true); + command_reply('Disabled.'); + }); + command_map.set('anon', () => { send_message({ msg: msg, sender: 'Anonymous User'}, io, socket); }); @@ -206,6 +220,11 @@ export function run_command(cmd_raw: string, uid: string, users: Map