Updated params

See FIXME comment for details
This commit is contained in:
Miguel Nogueira 2020-12-27 19:39:50 +00:00
parent 442db2b04f
commit b2ef7980e8
Signed by: miguel456
GPG Key ID: 2CF61B825316C6A0
1 changed files with 7 additions and 4 deletions

View File

@ -34,12 +34,15 @@ class Gimme implements Command
Analog::debug('Gimme: Count: ' . $parameters['quantity'] ?? 'unset'); Analog::debug('Gimme: Count: ' . $parameters['quantity'] ?? 'unset');
Analog::debug('Gimme: Raw parameter contents: ', json_encode($parameters)); Analog::debug('Gimme: Raw parameter contents: ', json_encode($parameters));
if ($parameters['quantity'] > 25)
// FIXME: The parameters are switched around. Thing is quantity and quantity is thing. This is probably a bug in the signature parser, it probably needs to be reworked
if ($parameters['thing'] > 25)
{ {
throw new Exception('Sorry, but I can\'t send you more than 25 cat pictures at a time. What a cat lover!'); throw new Exception('Sorry, but I can\'t send you more than 25 cat pictures at a time. What a cat lover!');
} }
switch($parameters['thing']) { switch($parameters['quantity']) {
case "cat": case "cat":
@ -47,7 +50,7 @@ class Gimme implements Command
try try
{ {
// Many pictures will return a list of pictures, separated by new lines // Many pictures will return a list of pictures, separated by new lines
return $this->cats->getCatPicture($parameters['what'], "small"); return $this->cats->getCatPicture($parameters['thing'], "small");
} }
catch (Exception $ex) catch (Exception $ex)
{ {
@ -57,7 +60,7 @@ class Gimme implements Command
break; break;
default: default:
throw new Exception("Uh oh. I don\'t know what you mean by " . $parameters['what'] . " Maybe try ? help?"); throw new Exception("Uh oh. I don\'t know what you mean by " . $parameters['quantity'] . ". '? help fun' for help.");
break; break;