@@ -9,75 +9,75 @@ |
||
9 | 9 | */ |
10 | 10 | class TelegramBotApiWrapper { |
11 | 11 | |
12 | - function exec_curl_request($handle) { |
|
13 | - $response = curl_exec($handle); |
|
12 | + function exec_curl_request($handle) { |
|
13 | + $response = curl_exec($handle); |
|
14 | 14 | |
15 | - if ($response === false) { |
|
16 | - $errno = curl_errno($handle); |
|
17 | - $error = curl_error($handle); |
|
18 | - echo("Curl returned error $errno: $error\n"); |
|
19 | - curl_close($handle); |
|
20 | - return false; |
|
21 | - } |
|
15 | + if ($response === false) { |
|
16 | + $errno = curl_errno($handle); |
|
17 | + $error = curl_error($handle); |
|
18 | + echo("Curl returned error $errno: $error\n"); |
|
19 | + curl_close($handle); |
|
20 | + return false; |
|
21 | + } |
|
22 | 22 | |
23 | - $http_code = intval(curl_getinfo($handle, CURLINFO_HTTP_CODE)); |
|
24 | - curl_close($handle); |
|
23 | + $http_code = intval(curl_getinfo($handle, CURLINFO_HTTP_CODE)); |
|
24 | + curl_close($handle); |
|
25 | 25 | |
26 | - if ($http_code >= 500) { |
|
27 | - // do not want to DDOS server if something goes wrong |
|
28 | - sleep(10); |
|
29 | - return false; |
|
30 | - } else if ($http_code != 200) { |
|
31 | - $response = json_decode($response, false); |
|
32 | - echo("Request has failed with error ".$response->error_code." : ".$response->description."\n"); |
|
33 | - if ($http_code == 401) { |
|
34 | - throw new Exception('Invalid access token provided'); |
|
35 | - } |
|
36 | - return false; |
|
37 | - } else { |
|
38 | - $response = json_decode($response, false); |
|
39 | - if (isset($response->description)) { |
|
40 | - echo("Request was successfull: ".$response->description."\n"); |
|
41 | - } |
|
42 | - $response = $response->result; |
|
43 | - } |
|
26 | + if ($http_code >= 500) { |
|
27 | + // do not want to DDOS server if something goes wrong |
|
28 | + sleep(10); |
|
29 | + return false; |
|
30 | + } else if ($http_code != 200) { |
|
31 | + $response = json_decode($response, false); |
|
32 | + echo("Request has failed with error ".$response->error_code." : ".$response->description."\n"); |
|
33 | + if ($http_code == 401) { |
|
34 | + throw new Exception('Invalid access token provided'); |
|
35 | + } |
|
36 | + return false; |
|
37 | + } else { |
|
38 | + $response = json_decode($response, false); |
|
39 | + if (isset($response->description)) { |
|
40 | + echo("Request was successfull: ".$response->description."\n"); |
|
41 | + } |
|
42 | + $response = $response->result; |
|
43 | + } |
|
44 | 44 | |
45 | - return $response; |
|
46 | - } |
|
45 | + return $response; |
|
46 | + } |
|
47 | 47 | |
48 | - function apiRequestJson($method, $parameters) { |
|
49 | - if (!is_string($method)) { |
|
50 | - echo("Method name must be a string\n"); |
|
51 | - return false; |
|
52 | - } |
|
48 | + function apiRequestJson($method, $parameters) { |
|
49 | + if (!is_string($method)) { |
|
50 | + echo("Method name must be a string\n"); |
|
51 | + return false; |
|
52 | + } |
|
53 | 53 | |
54 | - if (!$parameters) { |
|
55 | - $parameters = array(); |
|
56 | - } else if (!is_array($parameters)) { |
|
57 | - error_log("Parameters must be an array\n"); |
|
58 | - return false; |
|
59 | - } |
|
54 | + if (!$parameters) { |
|
55 | + $parameters = array(); |
|
56 | + } else if (!is_array($parameters)) { |
|
57 | + error_log("Parameters must be an array\n"); |
|
58 | + return false; |
|
59 | + } |
|
60 | 60 | |
61 | - $parameters["method"] = $method; |
|
61 | + $parameters["method"] = $method; |
|
62 | 62 | |
63 | - $_BOT_TOKEN = ''; |
|
64 | - //Load API key from json config |
|
65 | - if(file_exists('TelegramBot/api-key.json')) { |
|
66 | - //Create your own bot token and put it in api-key.json |
|
67 | - // like {"bot_token": "<your-bot-token>"} |
|
68 | - $json_config = json_decode(file_get_contents('TelegramBot/api-key.json')); |
|
69 | - $_BOT_TOKEN = $json_config->bot_token; |
|
70 | - } |
|
63 | + $_BOT_TOKEN = ''; |
|
64 | + //Load API key from json config |
|
65 | + if(file_exists('TelegramBot/api-key.json')) { |
|
66 | + //Create your own bot token and put it in api-key.json |
|
67 | + // like {"bot_token": "<your-bot-token>"} |
|
68 | + $json_config = json_decode(file_get_contents('TelegramBot/api-key.json')); |
|
69 | + $_BOT_TOKEN = $json_config->bot_token; |
|
70 | + } |
|
71 | 71 | |
72 | - $handle = curl_init('https://api.telegram.org/bot'.$_BOT_TOKEN.'/'); |
|
73 | - curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); |
|
74 | - curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5); |
|
75 | - curl_setopt($handle, CURLOPT_TIMEOUT, 60); |
|
76 | - curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); |
|
77 | - curl_setopt($handle, CURLOPT_POSTFIELDS, json_encode($parameters)); |
|
78 | - curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); |
|
72 | + $handle = curl_init('https://api.telegram.org/bot'.$_BOT_TOKEN.'/'); |
|
73 | + curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); |
|
74 | + curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, 5); |
|
75 | + curl_setopt($handle, CURLOPT_TIMEOUT, 60); |
|
76 | + curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); |
|
77 | + curl_setopt($handle, CURLOPT_POSTFIELDS, json_encode($parameters)); |
|
78 | + curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-Type: application/json")); |
|
79 | 79 | |
80 | - return $this->exec_curl_request($handle); |
|
81 | - } |
|
80 | + return $this->exec_curl_request($handle); |
|
81 | + } |
|
82 | 82 | |
83 | 83 | } |
84 | 84 | \ No newline at end of file |
@@ -8,38 +8,38 @@ |
||
8 | 8 | */ |
9 | 9 | class GenericCurl { |
10 | 10 | |
11 | - static function exec($url, $fields) { |
|
11 | + static function exec($url, $fields) { |
|
12 | 12 | |
13 | 13 | |
14 | - $fields_string = ""; |
|
15 | - //url-ify the data for the POST |
|
16 | - if(count($fields)>0) { |
|
17 | - foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } |
|
18 | - rtrim($fields_string, '&'); |
|
19 | - } |
|
14 | + $fields_string = ""; |
|
15 | + //url-ify the data for the POST |
|
16 | + if(count($fields)>0) { |
|
17 | + foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } |
|
18 | + rtrim($fields_string, '&'); |
|
19 | + } |
|
20 | 20 | |
21 | - //echo $fields_string; |
|
22 | - //open connection |
|
23 | - $ch = curl_init(); |
|
21 | + //echo $fields_string; |
|
22 | + //open connection |
|
23 | + $ch = curl_init(); |
|
24 | 24 | |
25 | - //set the url, number of POST vars, POST data |
|
26 | - curl_setopt($ch,CURLOPT_URL, $url); |
|
27 | - curl_setopt($ch,CURLOPT_POST, count($fields)); |
|
28 | - curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); |
|
29 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
30 | - curl_setopt ($ch, CURLOPT_COOKIEFILE, "TelegramBot/JarvisPHPSession.cookie"); |
|
31 | - curl_setopt($ch, CURLOPT_COOKIEJAR, "TelegramBot/JarvisPHPSession.cookie"); |
|
25 | + //set the url, number of POST vars, POST data |
|
26 | + curl_setopt($ch,CURLOPT_URL, $url); |
|
27 | + curl_setopt($ch,CURLOPT_POST, count($fields)); |
|
28 | + curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); |
|
29 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
|
30 | + curl_setopt ($ch, CURLOPT_COOKIEFILE, "TelegramBot/JarvisPHPSession.cookie"); |
|
31 | + curl_setopt($ch, CURLOPT_COOKIEJAR, "TelegramBot/JarvisPHPSession.cookie"); |
|
32 | 32 | |
33 | - //execute post |
|
34 | - $result = @curl_exec($ch); |
|
33 | + //execute post |
|
34 | + $result = @curl_exec($ch); |
|
35 | 35 | |
36 | - $http_response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
36 | + $http_response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
37 | 37 | |
38 | - //close connection |
|
39 | - curl_close($ch); |
|
38 | + //close connection |
|
39 | + curl_close($ch); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - return ($http_response_code==200) ? json_decode($result) : false; |
|
44 | - } |
|
43 | + return ($http_response_code==200) ? json_decode($result) : false; |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -5,20 +5,20 @@ discard block |
||
5 | 5 | define('CREDENTIALS_PATH', 'api-key.json'); |
6 | 6 | define('CLIENT_SECRET_PATH', 'secret-client-key.json'); |
7 | 7 | define('SCOPES', implode(' ', array( |
8 | - \Google_Service_Calendar::CALENDAR_READONLY) |
|
8 | + \Google_Service_Calendar::CALENDAR_READONLY) |
|
9 | 9 | )); |
10 | 10 | |
11 | - $client = new Google_Client(); |
|
12 | - $client->setApplicationName(APPLICATION_NAME); |
|
13 | - $client->setScopes(SCOPES); |
|
14 | - $client->setAuthConfigFile(CLIENT_SECRET_PATH); |
|
15 | - $client->setAccessType('offline'); |
|
11 | + $client = new Google_Client(); |
|
12 | + $client->setApplicationName(APPLICATION_NAME); |
|
13 | + $client->setScopes(SCOPES); |
|
14 | + $client->setAuthConfigFile(CLIENT_SECRET_PATH); |
|
15 | + $client->setAccessType('offline'); |
|
16 | 16 | |
17 | - // Load previously authorized credentials from a file. |
|
18 | - $credentialsPath = expandHomeDirectory(CREDENTIALS_PATH); |
|
19 | - if (file_exists($credentialsPath)) { |
|
17 | + // Load previously authorized credentials from a file. |
|
18 | + $credentialsPath = expandHomeDirectory(CREDENTIALS_PATH); |
|
19 | + if (file_exists($credentialsPath)) { |
|
20 | 20 | $accessToken = file_get_contents($credentialsPath); |
21 | - } else { |
|
21 | + } else { |
|
22 | 22 | // Request authorization from the user. |
23 | 23 | $authUrl = $client->createAuthUrl(); |
24 | 24 | printf("Open the following link in your browser:\n%s\n", $authUrl); |
@@ -30,15 +30,15 @@ discard block |
||
30 | 30 | |
31 | 31 | // Store the credentials to disk. |
32 | 32 | if(!file_exists(dirname($credentialsPath))) { |
33 | - mkdir(dirname($credentialsPath), 0700, true); |
|
33 | + mkdir(dirname($credentialsPath), 0700, true); |
|
34 | 34 | } |
35 | 35 | file_put_contents($credentialsPath, $accessToken); |
36 | 36 | printf("Credentials saved to %s\n", $credentialsPath); |
37 | - } |
|
38 | - $client->setAccessToken($accessToken); |
|
37 | + } |
|
38 | + $client->setAccessToken($accessToken); |
|
39 | 39 | |
40 | - // Refresh the token if it's expired. |
|
41 | - if ($client->isAccessTokenExpired()) { |
|
40 | + // Refresh the token if it's expired. |
|
41 | + if ($client->isAccessTokenExpired()) { |
|
42 | 42 | $client->refreshToken($client->getRefreshToken()); |
43 | 43 | file_put_contents($credentialsPath, $client->getAccessToken()); |
44 | - } |
|
44 | + } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | define('CREDENTIALS_PATH', 'Plugins/Gcalendar_plugin/api-key.json'); |
12 | 12 | define('CLIENT_SECRET_PATH', 'Plugins/Gcalendar_plugin/secret-client-key.json'); |
13 | 13 | define('SCOPES', implode(' ', array( |
14 | - \Google_Service_Calendar::CALENDAR_READONLY) |
|
14 | + \Google_Service_Calendar::CALENDAR_READONLY) |
|
15 | 15 | )); |
16 | 16 | define('_MAX_EVENTS', 4); |
17 | 17 | |
@@ -46,26 +46,26 @@ discard block |
||
46 | 46 | // Print the next _MAX_EVENTS events on the user's calendar. |
47 | 47 | $calendarId = 'primary'; |
48 | 48 | $optParams = array( |
49 | - 'maxResults' => _MAX_EVENTS, |
|
50 | - 'orderBy' => 'startTime', |
|
51 | - 'singleEvents' => TRUE, |
|
52 | - 'timeMin' => date('c'), |
|
49 | + 'maxResults' => _MAX_EVENTS, |
|
50 | + 'orderBy' => 'startTime', |
|
51 | + 'singleEvents' => TRUE, |
|
52 | + 'timeMin' => date('c'), |
|
53 | 53 | ); |
54 | 54 | $results = $service->events->listEvents($calendarId, $optParams); |
55 | 55 | |
56 | 56 | if (count($results->getItems()) == 0) { |
57 | - $answer = JarvisLanguage::translate('no_appointments',get_called_class()); |
|
57 | + $answer = JarvisLanguage::translate('no_appointments',get_called_class()); |
|
58 | 58 | } else { |
59 | 59 | |
60 | - foreach ($results->getItems() as $event) { |
|
60 | + foreach ($results->getItems() as $event) { |
|
61 | 61 | $start = $event->start->dateTime; |
62 | 62 | if (empty($start)) { |
63 | - $start = $event->start->date; |
|
63 | + $start = $event->start->date; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $date = new \DateTime($start); |
67 | 67 | $answer.= sprintf(JarvisLanguage::translate('list_events',get_called_class()), $date->format('j'), JarvisLanguage::translate('month_'.$date->format('n'),get_called_class()), $date->format('H'), $date->format('i'), $event->getSummary())."\n"; |
68 | - } |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | JarvisTTS::speak($answer); |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | * @return Google_Client the authorized client object |
103 | 103 | */ |
104 | 104 | function getClient() { |
105 | - $client = new \Google_Client(); |
|
106 | - $client->setApplicationName(APPLICATION_NAME); |
|
107 | - $client->setScopes(SCOPES); |
|
108 | - $client->setAuthConfigFile(CLIENT_SECRET_PATH); |
|
109 | - $client->setAccessType('offline'); |
|
105 | + $client = new \Google_Client(); |
|
106 | + $client->setApplicationName(APPLICATION_NAME); |
|
107 | + $client->setScopes(SCOPES); |
|
108 | + $client->setAuthConfigFile(CLIENT_SECRET_PATH); |
|
109 | + $client->setAccessType('offline'); |
|
110 | 110 | |
111 | - // Load previously authorized credentials from a file. |
|
112 | - $credentialsPath = CREDENTIALS_PATH; |
|
113 | - if (file_exists($credentialsPath)) { |
|
111 | + // Load previously authorized credentials from a file. |
|
112 | + $credentialsPath = CREDENTIALS_PATH; |
|
113 | + if (file_exists($credentialsPath)) { |
|
114 | 114 | $accessToken = file_get_contents($credentialsPath); |
115 | - } else { |
|
115 | + } else { |
|
116 | 116 | return null; |
117 | - } |
|
118 | - $client->setAccessToken($accessToken); |
|
117 | + } |
|
118 | + $client->setAccessToken($accessToken); |
|
119 | 119 | |
120 | - // Refresh the token if it's expired. |
|
121 | - if ($client->isAccessTokenExpired()) { |
|
120 | + // Refresh the token if it's expired. |
|
121 | + if ($client->isAccessTokenExpired()) { |
|
122 | 122 | $client->refreshToken($client->getRefreshToken()); |
123 | 123 | file_put_contents($credentialsPath, $client->getAccessToken()); |
124 | - } |
|
125 | - return $client; |
|
124 | + } |
|
125 | + return $client; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | } |
@@ -28,8 +28,8 @@ |
||
28 | 28 | //Extract search term |
29 | 29 | preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command, $matches); |
30 | 30 | $search_term = $matches[2]; |
31 | - $wiki_query_url = _WIKI_URL . "?action=opensearch&search=" . urlencode($search_term) . "&format=xml&limit=5"; |
|
32 | - $xml = simplexml_load_string(file_get_contents($wiki_query_url)); |
|
31 | + $wiki_query_url = _WIKI_URL . "?action=opensearch&search=" . urlencode($search_term) . "&format=xml&limit=5"; |
|
32 | + $xml = simplexml_load_string(file_get_contents($wiki_query_url)); |
|
33 | 33 | $item_array = $xml->Section->Item; |
34 | 34 | $answer = JarvisLanguage::translate('nothing_found',get_called_class()); |
35 | 35 | //Have i got results? |
@@ -125,16 +125,16 @@ discard block |
||
125 | 125 | $choosen_plugin = null; |
126 | 126 | //Cycling plugins |
127 | 127 | foreach(JarvisPHP::$active_plugins as $plugin_class) { |
128 | - $plugin = new $plugin_class(); |
|
129 | - //Load plugin's languages |
|
130 | - JarvisLanguage::loadPluginTranslation($plugin_class); |
|
131 | - if($plugin->isLikely($command)) { |
|
132 | - JarvisPHP::getLogger()->debug('Maybe '.JarvisPHP::getRealClassName($plugin_class).', check priority'); |
|
133 | - if($plugin->getPriority() > $max_priority_found) { |
|
134 | - $max_priority_found = $plugin->getPriority(); |
|
135 | - $choosen_plugin = $plugin; |
|
136 | - } |
|
137 | - } |
|
128 | + $plugin = new $plugin_class(); |
|
129 | + //Load plugin's languages |
|
130 | + JarvisLanguage::loadPluginTranslation($plugin_class); |
|
131 | + if($plugin->isLikely($command)) { |
|
132 | + JarvisPHP::getLogger()->debug('Maybe '.JarvisPHP::getRealClassName($plugin_class).', check priority'); |
|
133 | + if($plugin->getPriority() > $max_priority_found) { |
|
134 | + $max_priority_found = $plugin->getPriority(); |
|
135 | + $choosen_plugin = $plugin; |
|
136 | + } |
|
137 | + } |
|
138 | 138 | } |
139 | 139 | if(!is_null($choosen_plugin)) { |
140 | 140 | JarvisPHP::getLogger()->debug('Choosen plugin: '.JarvisPHP::getRealClassName(get_class($choosen_plugin))); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | public static function getNameSpace($fullClassName) { |
191 | - //Explode class name |
|
191 | + //Explode class name |
|
192 | 192 | $classNameArray = explode('\\',$fullClassName); |
193 | 193 | //Remove the pure class name |
194 | 194 | array_pop($classNameArray); |
@@ -9,23 +9,23 @@ |
||
9 | 9 | */ |
10 | 10 | class JarvisBehaviourLanguage { |
11 | 11 | |
12 | - public static $jbl_set = array(); |
|
12 | + public static $jbl_set = array(); |
|
13 | 13 | |
14 | - public function loadBehaviourLanguage() { |
|
15 | - if(file_exists('language/jbl_'._LANGUAGE.'.jbl')) { |
|
16 | - JarvisBehaviourLanguage::$jbl_set = json_decode(file_get_contents('language/jbl_'._LANGUAGE.'.jbl')); |
|
17 | - } |
|
18 | - } |
|
14 | + public function loadBehaviourLanguage() { |
|
15 | + if(file_exists('language/jbl_'._LANGUAGE.'.jbl')) { |
|
16 | + JarvisBehaviourLanguage::$jbl_set = json_decode(file_get_contents('language/jbl_'._LANGUAGE.'.jbl')); |
|
17 | + } |
|
18 | + } |
|
19 | 19 | |
20 | - public function answer($sentence) { |
|
21 | - foreach(JarvisBehaviourLanguage::$jbl_set->rules as $rule) { |
|
22 | - foreach($rule->matches as $match) { |
|
23 | - if(preg_match($match, $sentence)) { |
|
24 | - return $rule->responses[array_rand($rule->responses)]; |
|
25 | - } |
|
26 | - } |
|
27 | - } |
|
28 | - return false; |
|
29 | - } |
|
20 | + public function answer($sentence) { |
|
21 | + foreach(JarvisBehaviourLanguage::$jbl_set->rules as $rule) { |
|
22 | + foreach($rule->matches as $match) { |
|
23 | + if(preg_match($match, $sentence)) { |
|
24 | + return $rule->responses[array_rand($rule->responses)]; |
|
25 | + } |
|
26 | + } |
|
27 | + } |
|
28 | + return false; |
|
29 | + } |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -12,23 +12,23 @@ |
||
12 | 12 | |
13 | 13 | public static function speak($sentence) { |
14 | 14 | |
15 | - //Do not request a new mp3 if it exists in cache folder |
|
16 | - if(!file_exists(_JARVISPHP_ROOT_PATH.'/Speakers/cache/'.md5($sentence).'.mp3')) { |
|
17 | - $curl = curl_init(); |
|
15 | + //Do not request a new mp3 if it exists in cache folder |
|
16 | + if(!file_exists(_JARVISPHP_ROOT_PATH.'/Speakers/cache/'.md5($sentence).'.mp3')) { |
|
17 | + $curl = curl_init(); |
|
18 | 18 | |
19 | - curl_setopt_array($curl, array( |
|
20 | - CURLOPT_RETURNTRANSFER => 1, |
|
21 | - CURLOPT_URL => 'http://translate.google.com/translate_tts?ie=UTF-8&client=t&tl='._LANGUAGE.'&q='.urlencode($sentence), |
|
22 | - CURLOPT_USERAGENT => 'stagefright/1.2 (Linux;Android 5.0)', |
|
23 | - CURLOPT_REFERER => 'http://translate.google.com/' |
|
24 | - )); |
|
19 | + curl_setopt_array($curl, array( |
|
20 | + CURLOPT_RETURNTRANSFER => 1, |
|
21 | + CURLOPT_URL => 'http://translate.google.com/translate_tts?ie=UTF-8&client=t&tl='._LANGUAGE.'&q='.urlencode($sentence), |
|
22 | + CURLOPT_USERAGENT => 'stagefright/1.2 (Linux;Android 5.0)', |
|
23 | + CURLOPT_REFERER => 'http://translate.google.com/' |
|
24 | + )); |
|
25 | 25 | |
26 | - $resp = curl_exec($curl); |
|
26 | + $resp = curl_exec($curl); |
|
27 | 27 | |
28 | - curl_close($curl); |
|
28 | + curl_close($curl); |
|
29 | 29 | |
30 | - file_put_contents(_JARVISPHP_ROOT_PATH.'/Speakers/cache/'.md5($sentence).'.mp3', $resp); |
|
31 | - } |
|
30 | + file_put_contents(_JARVISPHP_ROOT_PATH.'/Speakers/cache/'.md5($sentence).'.mp3', $resp); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | exec('aplay '._JARVISPHP_ROOT_PATH.'/Speakers/cache/'.md5($sentence).'.mp3'); |
34 | 34 | } |
@@ -14,6 +14,6 @@ |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | if($json_config) { |
17 | - //Let's start the bot |
|
18 | - JarvisPHPTelegramBot::run($json_config->allowedClientIdList); |
|
17 | + //Let's start the bot |
|
18 | + JarvisPHPTelegramBot::run($json_config->allowedClientIdList); |
|
19 | 19 | } |
20 | 20 | \ No newline at end of file |