--- /dev/null
+<?php
+
+namespace App\TwitchBot;
+
+use App\Models\Channel;
+
+abstract class ChatCommand {
+
+ public static function create(TwitchBot $bot, Channel $channel, $config) {
+ $cmd = null;
+ switch ($config['command']) {
+ case 'crew':
+ $cmd = new CrewCommand();
+ break;
+ case 'runner':
+ $cmd = new RunnerCommand();
+ break;
+ default:
+ throw new \Exception('command '.$str.' not found');
+ }
+ $cmd->bot = $bot;
+ $cmd->channel = $channel;
+ $cmd->config = $config;
+ return $cmd;
+ }
+
+ public abstract function execute($args);
+
+ protected function getBooleanConfig($name, $default = false) {
+ return array_key_exists($name, $this->config) ? $this->config[$name] : $default;
+ }
+
+ protected function messageChannel($str) {
+ $msg = IRCMessage::privmsg($this->channel->twitch_chat, $str);
+ $this->bot->sendIRCMessage($msg);
+ }
+
+ protected $bot;
+ protected $channel;
+ protected $config;
+
+}
+
+?>