From b2ef7980e810e7f9a2ce65d1bda40ecf8ae536e2 Mon Sep 17 00:00:00 2001 From: Miguel N Date: Sun, 27 Dec 2020 19:39:50 +0000 Subject: [PATCH] Updated params See FIXME comment for details --- src/Bot/Commands/Gimme.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Bot/Commands/Gimme.php b/src/Bot/Commands/Gimme.php index bffd73e..f39db95 100644 --- a/src/Bot/Commands/Gimme.php +++ b/src/Bot/Commands/Gimme.php @@ -34,12 +34,15 @@ class Gimme implements Command Analog::debug('Gimme: Count: ' . $parameters['quantity'] ?? 'unset'); 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!'); } - switch($parameters['thing']) { + switch($parameters['quantity']) { case "cat": @@ -47,7 +50,7 @@ class Gimme implements Command try { // 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) { @@ -57,7 +60,7 @@ class Gimme implements Command break; 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;