public function __construct() { $this->_downloader = \App::getDownloader(); $this->_mopidy = \App::getMopidy(); $this->_parser = \App::getParser(); $this->_slack = \App::getSlack(); }
public function testParseSong() { $parser = App::getParser(); $url = '<http://mp3.zing.vn/bai-hat/Chuyen-Mua-Acoustic-Version-Trung-Quan-Idol/ZWZEI8C6.html>'; $result = $parser->match($url); $this->assertNotEquals(FALSE, $result, "Matching failed"); $this->assertEquals('http://mp3.zing.vn/bai-hat/Chuyen-Mua-Acoustic-Version-Trung-Quan-Idol/ZWZEI8C6.html', $result, "Removing prefix/suffix failed"); }
$remote->startService(); $isRunning = $remote->getServiceStatus(); $responseText = $isRunning ? "Hế nhô :kissing_smiling_eyes:" : ":zzz:"; } break; case 'sleep': $remote->stopService(); $isRunning = $remote->getServiceStatus(); $responseText = $isRunning ? "Ko hiểu sao nhưng vưỡn tỉnh như sáo :flushed:" : ":zzz:"; break; case 'restart': $remote->restartService(); $responseText = "Restarted"; break; default: $result = \App::getParser()->match($text); if ($result !== FALSE) { \App::getQueue()->add('getter', ['url' => $result, 'originData' => $params]); } else { if ($text != '' && isset($params['chatbot'])) { require_once 'chatbot/simsimi_api_class.php'; $obj = new SimSimiAPI(); $responseText = ''; try { $result = $obj->simSimiConversation('vn', '1.0', $text); $responseText = $result['response']; $responseText = str_ireplace(['simsimi', 'simi', 'sim', 'gà chip', 'tao'], 'em', $responseText); } catch (Exception $e) { file_put_contents('/tmp/chat_error.log', $e->getMessage()); } }