public function __construct(array $config) { $parameters = array('oauth_token'); foreach ($parameters as $parameter) { if (isset($config['slack_' . $parameter])) { $this->{$parameter} = $config['slack_' . $parameter]; } if (is_null($this->{$parameter})) { throw new \Exception("slack_{$parameter} must be configured"); } } return parent::__construct($config, 'slack'); }
<?php require '../bootstrap.php'; use jt2k\Jarvis\Bot; if (isset($_POST) && isset($_POST['text'])) { $bot = new Bot($jarvis_config, 'web'); echo $bot->respond(array('text' => $_POST['text'], 'user_name' => $_POST['name'], 'bot_type' => 'web')); }