FugiTech/kaet

Counters can override commands

Closed this issue · 1 comments

Have not tested in practice, but I don't see any guards in the code against counter names overriding existing commands (built-in or mod-added).

Example: "!inc help" would override the "help" command with a counter. Also, "!reset help" would delete the "help" command without the checks present in "removecommand".

Multiple possible approaches to fix:

  1. Modify "inc"/"dec" to return an error if a new counter already exists as a command (perhaps add an else block on the call to "counters.Get" that performs this check). Modify "reset" to only remove the command if "counters.Remove" succeeds.
  2. Add an "addcounter" command. Modify "inc"/"dec"/"reset" to only work on existing counters. "addcounter" should check that a command with the same name doesn't already exist before creating a counter and command.