]> git.localhorst.tv Git - alttp.git/blobdiff - app/TwitchBotCommands/BaseCommand.php
chat adlib prototype
[alttp.git] / app / TwitchBotCommands / BaseCommand.php
index 881d4ed03e91c3611ac5fe7d65e4564be0154b8a..e2df728d0eb76a59970dff23aca17ed0a13705e3 100644 (file)
@@ -10,12 +10,16 @@ abstract class BaseCommand {
 
        public static function resolve(TwitchBot $bot, TwitchBotCommand $cmd) {
                switch ($cmd->command) {
+                       case 'chat':
+                               return new ChatCommand($bot, $cmd);
                        case 'join':
                                return new JoinCommand($bot, $cmd);
                        case 'part':
                                return new PartCommand($bot, $cmd);
+                       case 'random-chat':
+                               return new RandomChatCommand($bot, $cmd);
                        default:
-                               throw new Exception('unrecognized command');
+                               throw new \Exception('unrecognized command');
                }
        }
 
@@ -40,6 +44,10 @@ abstract class BaseCommand {
                return User::findOrFail($this->getParameter('user'));
        }
 
+       protected function getExecutingUser() {
+               return $this->command->user;
+       }
+
        protected function hasParameter($name) {
                return array_key_exists($name, $this->command->parameters);
        }