@@ -17,6 +17,9 @@ |
||
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $sentence |
|
22 | + */ |
|
20 | 23 | public function answer($sentence) { |
21 | 24 | foreach(JarvisBehaviourLanguage::$jbl_set->rules as $rule) { |
22 | 25 | foreach($rule->matches as $match) { |
@@ -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,15 +12,15 @@ |
||
12 | 12 | public static $jbl_set = array(); |
13 | 13 | |
14 | 14 | public function loadBehaviourLanguage() { |
15 | - if(file_exists('language/jbl_'._LANGUAGE.'.jbl')) { |
|
15 | + if (file_exists('language/jbl_'._LANGUAGE.'.jbl')) { |
|
16 | 16 | JarvisBehaviourLanguage::$jbl_set = json_decode(file_get_contents('language/jbl_'._LANGUAGE.'.jbl')); |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | 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)) { |
|
21 | + foreach (JarvisBehaviourLanguage::$jbl_set->rules as $rule) { |
|
22 | + foreach ($rule->matches as $match) { |
|
23 | + if (preg_match($match, $sentence)) { |
|
24 | 24 | return $rule->responses[array_rand($rule->responses)]; |
25 | 25 | } |
26 | 26 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * Is it the right plugin for the command? |
85 | 85 | * @param string $command |
86 | - * @return boolean |
|
86 | + * @return integer |
|
87 | 87 | */ |
88 | 88 | function isLikely($command) { |
89 | 89 | return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Returns an authorized API client. |
102 | - * @return Google_Client the authorized client object |
|
102 | + * @return null|\Google_Client the authorized client object |
|
103 | 103 | */ |
104 | 104 | function getClient() { |
105 | 105 | $client = new \Google_Client(); |
@@ -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 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @author Stefano Bianchini |
21 | 21 | * @website http://www.stefanobianchini.net |
22 | 22 | */ |
23 | -class Gcalendar_plugin implements \JarvisPHP\Core\JarvisPluginInterface{ |
|
23 | +class Gcalendar_plugin implements \JarvisPHP\Core\JarvisPluginInterface { |
|
24 | 24 | /** |
25 | 25 | * Priority of plugin |
26 | 26 | * @var int |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | // Get the API client and construct the service object. |
40 | 40 | $client = Gcalendar_plugin::getClient(); |
41 | 41 | |
42 | - if($client==null) return null; |
|
42 | + if ($client == null) return null; |
|
43 | 43 | |
44 | 44 | $service = new \Google_Service_Calendar($client); |
45 | 45 | |
@@ -54,7 +54,7 @@ discard block |
||
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 | 60 | foreach ($results->getItems() as $event) { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | $date = new \DateTime($start); |
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"; |
|
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 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return boolean |
87 | 87 | */ |
88 | 88 | function isLikely($command) { |
89 | - return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
|
89 | + return preg_match(JarvisLanguage::translate('preg_match_activate_plugin', get_called_class()), $command); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -39,7 +39,9 @@ |
||
39 | 39 | // Get the API client and construct the service object. |
40 | 40 | $client = Gcalendar_plugin::getClient(); |
41 | 41 | |
42 | - if($client==null) return null; |
|
42 | + if($client==null) { |
|
43 | + return null; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | $service = new \Google_Service_Calendar($client); |
45 | 47 |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace JarvisPHP\Plugins\Wemo_plugin; |
4 | 4 | |
5 | -use JarvisPHP\Core\JarvisSession; |
|
6 | 5 | use JarvisPHP\Core\JarvisPHP; |
7 | 6 | use JarvisPHP\Core\JarvisLanguage; |
8 | 7 | use JarvisPHP\Core\JarvisTTS; |
@@ -2,10 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace JarvisPHP\Plugins\RaspPIVolume_plugin; |
4 | 4 | |
5 | -use JarvisPHP\Core\JarvisSession; |
|
6 | 5 | use JarvisPHP\Core\JarvisPHP; |
7 | 6 | use JarvisPHP\Core\JarvisLanguage; |
8 | -use JarvisPHP\Core\JarvisTTS; |
|
9 | 7 | |
10 | 8 | /** |
11 | 9 | * RaspberryPI Volume Control Plugin |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @website http://www.stefanobianchini.net |
14 | 14 | * Bash script from http://www.dronkert.net/rpi/vol.html |
15 | 15 | */ |
16 | -class RaspPIVolume_plugin implements \JarvisPHP\Core\JarvisPluginInterface{ |
|
16 | +class RaspPIVolume_plugin implements \JarvisPHP\Core\JarvisPluginInterface { |
|
17 | 17 | /** |
18 | 18 | * Priority of plugin |
19 | 19 | * @var int |
@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | function answer($command) { |
28 | 28 | $answer = ''; |
29 | 29 | |
30 | - if(preg_match(JarvisLanguage::translate('preg_match_mute',get_called_class()), $command)) { |
|
30 | + if (preg_match(JarvisLanguage::translate('preg_match_mute', get_called_class()), $command)) { |
|
31 | 31 | //Mute command |
32 | 32 | exec(_JARVISPHP_ROOT_PATH.'/Plugins/RaspPIVolume_plugin/vol.sh 0'); |
33 | - } else if(preg_match(JarvisLanguage::translate('preg_match_unmute',get_called_class()), $command)) { |
|
33 | + } else if (preg_match(JarvisLanguage::translate('preg_match_unmute', get_called_class()), $command)) { |
|
34 | 34 | //Unmute command |
35 | 35 | exec(_JARVISPHP_ROOT_PATH.'/Plugins/RaspPIVolume_plugin/vol.sh 65'); |
36 | - } else if(preg_match(JarvisLanguage::translate('preg_match_volume_up',get_called_class()), $command)) { |
|
36 | + } else if (preg_match(JarvisLanguage::translate('preg_match_volume_up', get_called_class()), $command)) { |
|
37 | 37 | //Volume up command |
38 | 38 | exec(_JARVISPHP_ROOT_PATH.'/Plugins/RaspPIVolume_plugin/vol.sh +'); |
39 | - } else if(preg_match(JarvisLanguage::translate('preg_match_volume_down',get_called_class()), $command)) { |
|
39 | + } else if (preg_match(JarvisLanguage::translate('preg_match_volume_down', get_called_class()), $command)) { |
|
40 | 40 | //Volume down |
41 | 41 | exec(_JARVISPHP_ROOT_PATH.'/Plugins/RaspPIVolume_plugin/vol.sh -'); |
42 | 42 | } |
43 | - $answer = JarvisLanguage::translate('command_executed',get_called_class()); |
|
43 | + $answer = JarvisLanguage::translate('command_executed', get_called_class()); |
|
44 | 44 | $response = new \JarvisPHP\Core\JarvisResponse($answer, JarvisPHP::getRealClassName(get_called_class()), true); |
45 | 45 | $response->send(); |
46 | 46 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return boolean |
59 | 59 | */ |
60 | 60 | function isLikely($command) { |
61 | - return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
|
61 | + return preg_match(JarvisLanguage::translate('preg_match_activate_plugin', get_called_class()), $command); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -86,7 +86,7 @@ |
||
86 | 86 | /** |
87 | 87 | * Is it the right plugin for the command? |
88 | 88 | * @param string $command |
89 | - * @return boolean |
|
89 | + * @return integer |
|
90 | 90 | */ |
91 | 91 | function isLikely($command) { |
92 | 92 | return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
@@ -86,7 +86,7 @@ |
||
86 | 86 | /** |
87 | 87 | * Is it the right plugin for the command? |
88 | 88 | * @param string $command |
89 | - * @return boolean |
|
89 | + * @return integer |
|
90 | 90 | */ |
91 | 91 | function isLikely($command) { |
92 | 92 | return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace JarvisPHP\Plugins\Wemo_plugin; |
4 | 4 | |
5 | -use JarvisPHP\Core\JarvisSession; |
|
6 | 5 | use JarvisPHP\Core\JarvisPHP; |
7 | 6 | use JarvisPHP\Core\JarvisLanguage; |
8 | 7 | use JarvisPHP\Core\JarvisTTS; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @author Stefano Bianchini |
13 | 13 | * @website http://www.stefanobianchini.net |
14 | 14 | */ |
15 | -class Wemo_plugin implements \JarvisPHP\Core\JarvisPluginInterface{ |
|
15 | +class Wemo_plugin implements \JarvisPHP\Core\JarvisPluginInterface { |
|
16 | 16 | /** |
17 | 17 | * Priority of plugin |
18 | 18 | * @var int |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $_IFTTT_MAKER_EVENT = ''; |
32 | 32 | |
33 | 33 | //Load API key from json config |
34 | - if(file_exists('Plugins/Wemo_plugin/api-key.json')) { |
|
34 | + if (file_exists('Plugins/Wemo_plugin/api-key.json')) { |
|
35 | 35 | //Create your own api key and put it in api-key.json |
36 | 36 | $json_config = json_decode(file_get_contents('Plugins/Wemo_plugin/api-key.json')); |
37 | 37 | $_IFTTT_MAKER_KEY = $json_config->ifttt_key; |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
61 | 61 | $result = curl_exec($ch); |
62 | 62 | |
63 | - if(!$result) { |
|
63 | + if (!$result) { |
|
64 | 64 | JarvisPHP::getLogger()->error('Curl error: '.curl_error($ch)); |
65 | - $answer = JarvisLanguage::translate('command_not_sent',get_called_class()); |
|
65 | + $answer = JarvisLanguage::translate('command_not_sent', get_called_class()); |
|
66 | 66 | } |
67 | 67 | else { |
68 | - $answer = JarvisLanguage::translate('command_sent_to_light_switch',get_called_class()); |
|
68 | + $answer = JarvisLanguage::translate('command_sent_to_light_switch', get_called_class()); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | curl_close($ch); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return boolean |
90 | 90 | */ |
91 | 91 | function isLikely($command) { |
92 | - return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
|
92 | + return preg_match(JarvisLanguage::translate('preg_match_activate_plugin', get_called_class()), $command); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -63,8 +63,7 @@ |
||
63 | 63 | if(!$result) { |
64 | 64 | JarvisPHP::getLogger()->error('Curl error: '.curl_error($ch)); |
65 | 65 | $answer = JarvisLanguage::translate('command_not_sent',get_called_class()); |
66 | - } |
|
67 | - else { |
|
66 | + } else { |
|
68 | 67 | $answer = JarvisLanguage::translate('command_sent_to_light_switch',get_called_class()); |
69 | 68 | } |
70 | 69 |
@@ -8,6 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | class GenericCurl { |
10 | 10 | |
11 | + /** |
|
12 | + * @param string $url |
|
13 | + */ |
|
11 | 14 | static function exec($url, $fields) { |
12 | 15 | |
13 | 16 |
@@ -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 |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | |
14 | 14 | $fields_string = ""; |
15 | 15 | //url-ify the data for the POST |
16 | - if(count($fields)>0) { |
|
17 | - foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } |
|
16 | + if (count($fields) > 0) { |
|
17 | + foreach ($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } |
|
18 | 18 | rtrim($fields_string, '&'); |
19 | 19 | } |
20 | 20 | |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | $ch = curl_init(); |
24 | 24 | |
25 | 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); |
|
26 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
27 | + curl_setopt($ch, CURLOPT_POST, count($fields)); |
|
28 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); |
|
29 | 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
30 | - curl_setopt ($ch, CURLOPT_COOKIEFILE, "TelegramBot/JarvisPHPSession.cookie"); |
|
30 | + curl_setopt($ch, CURLOPT_COOKIEFILE, "TelegramBot/JarvisPHPSession.cookie"); |
|
31 | 31 | curl_setopt($ch, CURLOPT_COOKIEJAR, "TelegramBot/JarvisPHPSession.cookie"); |
32 | 32 | |
33 | 33 | //execute post |
@@ -40,6 +40,6 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - return ($http_response_code==200) ? json_decode($result) : false; |
|
43 | + return ($http_response_code == 200) ? json_decode($result) : false; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | \ No newline at end of file |
@@ -9,6 +9,9 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class TelegramBotApiWrapper { |
11 | 11 | |
12 | + /** |
|
13 | + * @param resource $handle |
|
14 | + */ |
|
12 | 15 | function exec_curl_request($handle) { |
13 | 16 | $response = curl_exec($handle); |
14 | 17 | |
@@ -45,6 +48,9 @@ discard block |
||
45 | 48 | return $response; |
46 | 49 | } |
47 | 50 | |
51 | + /** |
|
52 | + * @param string $method |
|
53 | + */ |
|
48 | 54 | function apiRequestJson($method, $parameters) { |
49 | 55 | if (!is_string($method)) { |
50 | 56 | echo("Method name must be a string\n"); |
@@ -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 |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | $_BOT_TOKEN = ''; |
64 | 64 | //Load API key from json config |
65 | - if(file_exists('TelegramBot/api-key.json')) { |
|
65 | + if (file_exists('TelegramBot/api-key.json')) { |
|
66 | 66 | //Create your own bot token and put it in api-key.json |
67 | 67 | // like {"bot_token": "<your-bot-token>"} |
68 | 68 | $json_config = json_decode(file_get_contents('TelegramBot/api-key.json')); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use JarvisPHP\TelegramBot\GenericCurl; |
6 | 6 | |
7 | 7 | //Very important! |
8 | -define('_JARVISPHP_URL','http://localhost:8000'); |
|
8 | +define('_JARVISPHP_URL', 'http://localhost:8000'); |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * A TelegramBot for JarvisPHP |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | echo "JarvisPHP Telegram Bot started at ".date('Y-m-d H:i:s')."\n"; |
24 | 24 | echo "-----------------------------------------------------\n"; |
25 | 25 | |
26 | - while(true) { |
|
26 | + while (true) { |
|
27 | 27 | |
28 | 28 | $updates = $bot->apiRequestJson("getUpdates", array('offset'=>$offset)); |
29 | 29 | |
30 | - if($updates) { |
|
31 | - foreach($updates as $update) { |
|
30 | + if ($updates) { |
|
31 | + foreach ($updates as $update) { |
|
32 | 32 | |
33 | - if(isset($update->message->text)) { |
|
33 | + if (isset($update->message->text)) { |
|
34 | 34 | |
35 | 35 | //TODO check if $update->message->chat->id is in enabled list |
36 | 36 | |
@@ -40,28 +40,28 @@ discard block |
||
40 | 40 | |
41 | 41 | $message = $update->message->text; |
42 | 42 | |
43 | - $offset = $update->update_id + 1; |
|
43 | + $offset = $update->update_id+1; |
|
44 | 44 | |
45 | 45 | $response = ''; |
46 | 46 | |
47 | 47 | //Understand if the message is a telegram command (begins with "/") |
48 | - if(preg_match('$^/(.+)$', $message)) { |
|
48 | + if (preg_match('$^/(.+)$', $message)) { |
|
49 | 49 | |
50 | 50 | //Telegram command |
51 | - switch($message) { |
|
52 | - case '/start': $response='I am JarvisPHP, a private bot. \u1F510'; break; |
|
53 | - case '/info': $response='I am JarvisPHP, a private bot. \u1F510'; break; |
|
51 | + switch ($message) { |
|
52 | + case '/start': $response = 'I am JarvisPHP, a private bot. \u1F510'; break; |
|
53 | + case '/info': $response = 'I am JarvisPHP, a private bot. \u1F510'; break; |
|
54 | 54 | case '/register': |
55 | - $response='Ok, i registered your ID in registerIdLog.log'; |
|
56 | - file_put_contents('TelegramBot/registerIdLog.log', '['.date('Y-m-d H:i:s').'] ID:'.$update->message->from->id . '; FIRSTNAME:'. $update->message->from->first_name . '; LASTNAME:'. $update->message->from->last_name. '; USERNAME:'. $update->message->from->username.PHP_EOL , FILE_APPEND | LOCK_EX); |
|
55 | + $response = 'Ok, i registered your ID in registerIdLog.log'; |
|
56 | + file_put_contents('TelegramBot/registerIdLog.log', '['.date('Y-m-d H:i:s').'] ID:'.$update->message->from->id.'; FIRSTNAME:'.$update->message->from->first_name.'; LASTNAME:'.$update->message->from->last_name.'; USERNAME:'.$update->message->from->username.PHP_EOL, FILE_APPEND | LOCK_EX); |
|
57 | 57 | break; |
58 | - case '/say': $response='Use /say "sentence" (without quotes) to make JarvisPHP speak a sentence.'; break; |
|
58 | + case '/say': $response = 'Use /say "sentence" (without quotes) to make JarvisPHP speak a sentence.'; break; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | //"Say" Telegram command |
62 | - if(preg_match('$^/say (.+)$', $message, $matches)) { |
|
63 | - if($matches) { |
|
64 | - if(in_array($update->message->chat->id, $allowedClientIdList)) { |
|
62 | + if (preg_match('$^/say (.+)$', $message, $matches)) { |
|
63 | + if ($matches) { |
|
64 | + if (in_array($update->message->chat->id, $allowedClientIdList)) { |
|
65 | 65 | //Redirect message to JarvisPhp |
66 | 66 | $JarvisResponse = GenericCurl::exec(_JARVISPHP_URL.'/answer', array('sentence'=>$matches[0])); |
67 | 67 | |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | //Encode emoji |
76 | - $response = preg_replace_callback('/\\\\u([0-9a-fA-F]+)/', function ($match) { |
|
76 | + $response = preg_replace_callback('/\\\\u([0-9a-fA-F]+)/', function($match) { |
|
77 | 77 | return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($match[1]))); |
78 | 78 | }, $response); |
79 | 79 | |
80 | 80 | } else { |
81 | - if(in_array($update->message->chat->id, $allowedClientIdList)) { |
|
81 | + if (in_array($update->message->chat->id, $allowedClientIdList)) { |
|
82 | 82 | //Redirect message to JarvisPhp |
83 | 83 | $JarvisResponse = GenericCurl::exec(_JARVISPHP_URL.'/answer', array('command'=>$message, 'tts' => 'None_tts')); |
84 | 84 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | } |
91 | - if($response) { |
|
91 | + if ($response) { |
|
92 | 92 | $bot->apiRequestJson("sendMessage", array('chat_id' => $update->message->chat->id, "text" => $response)); |
93 | 93 | } |
94 | 94 | } |
@@ -14,87 +14,87 @@ |
||
14 | 14 | */ |
15 | 15 | class JarvisPHPTelegramBot { |
16 | 16 | |
17 | - public static function run($allowedClientIdList) { |
|
17 | + public static function run($allowedClientIdList) { |
|
18 | 18 | |
19 | - $bot = new TelegramBotApiWrapper(); |
|
19 | + $bot = new TelegramBotApiWrapper(); |
|
20 | 20 | |
21 | - $offset = 0; |
|
21 | + $offset = 0; |
|
22 | 22 | |
23 | - echo "JarvisPHP Telegram Bot started at ".date('Y-m-d H:i:s')."\n"; |
|
24 | - echo "-----------------------------------------------------\n"; |
|
23 | + echo "JarvisPHP Telegram Bot started at ".date('Y-m-d H:i:s')."\n"; |
|
24 | + echo "-----------------------------------------------------\n"; |
|
25 | 25 | |
26 | - while(true) { |
|
26 | + while(true) { |
|
27 | 27 | |
28 | - $updates = $bot->apiRequestJson("getUpdates", array('offset'=>$offset)); |
|
28 | + $updates = $bot->apiRequestJson("getUpdates", array('offset'=>$offset)); |
|
29 | 29 | |
30 | - if($updates) { |
|
31 | - foreach($updates as $update) { |
|
30 | + if($updates) { |
|
31 | + foreach($updates as $update) { |
|
32 | 32 | |
33 | - if(isset($update->message->text)) { |
|
33 | + if(isset($update->message->text)) { |
|
34 | 34 | |
35 | - //TODO check if $update->message->chat->id is in enabled list |
|
35 | + //TODO check if $update->message->chat->id is in enabled list |
|
36 | 36 | |
37 | - $bot->apiRequestJson("sendChatAction", array('chat_id' => $update->message->chat->id, 'action' => 'typing')); |
|
37 | + $bot->apiRequestJson("sendChatAction", array('chat_id' => $update->message->chat->id, 'action' => 'typing')); |
|
38 | 38 | |
39 | - echo "Processing message ->".$update->message->text."\n"; |
|
39 | + echo "Processing message ->".$update->message->text."\n"; |
|
40 | 40 | |
41 | - $message = $update->message->text; |
|
41 | + $message = $update->message->text; |
|
42 | 42 | |
43 | - $offset = $update->update_id + 1; |
|
43 | + $offset = $update->update_id + 1; |
|
44 | 44 | |
45 | - $response = ''; |
|
45 | + $response = ''; |
|
46 | 46 | |
47 | - //Understand if the message is a telegram command (begins with "/") |
|
48 | - if(preg_match('$^/(.+)$', $message)) { |
|
47 | + //Understand if the message is a telegram command (begins with "/") |
|
48 | + if(preg_match('$^/(.+)$', $message)) { |
|
49 | 49 | |
50 | - //Telegram command |
|
51 | - switch($message) { |
|
52 | - case '/start': $response='I am JarvisPHP, a private bot. \u1F510'; break; |
|
53 | - case '/info': $response='I am JarvisPHP, a private bot. \u1F510'; break; |
|
54 | - case '/register': |
|
55 | - $response='Ok, i registered your ID in registerIdLog.log'; |
|
56 | - file_put_contents('TelegramBot/registerIdLog.log', '['.date('Y-m-d H:i:s').'] ID:'.$update->message->from->id . '; FIRSTNAME:'. $update->message->from->first_name . '; LASTNAME:'. $update->message->from->last_name. '; USERNAME:'. $update->message->from->username.PHP_EOL , FILE_APPEND | LOCK_EX); |
|
57 | - break; |
|
58 | - case '/say': $response='Use /say "sentence" (without quotes) to make JarvisPHP speak a sentence.'; break; |
|
59 | - } |
|
60 | - |
|
61 | - //"Say" Telegram command |
|
62 | - if(preg_match('$^/say (.+)$', $message, $matches)) { |
|
63 | - if($matches) { |
|
64 | - if(in_array($update->message->chat->id, $allowedClientIdList)) { |
|
65 | - //Redirect message to JarvisPhp |
|
66 | - $JarvisResponse = GenericCurl::exec(_JARVISPHP_URL.'/say', array('sentence'=>$matches[1])); |
|
67 | - |
|
68 | - $response = $JarvisResponse->answer; |
|
69 | - } else { |
|
70 | - $response = 'You are not allowed to speak with me.'; |
|
71 | - } |
|
72 | - } |
|
73 | - } |
|
74 | - |
|
75 | - //Encode emoji |
|
76 | - $response = preg_replace_callback('/\\\\u([0-9a-fA-F]+)/', function ($match) { |
|
77 | - return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($match[1]))); |
|
78 | - }, $response); |
|
79 | - |
|
80 | - } else { |
|
81 | - if(in_array($update->message->chat->id, $allowedClientIdList)) { |
|
82 | - //Redirect message to JarvisPhp |
|
83 | - $JarvisResponse = GenericCurl::exec(_JARVISPHP_URL.'/answer', array('command'=>$message, 'tts' => 'None_tts')); |
|
84 | - |
|
85 | - $response = $JarvisResponse->answer; |
|
86 | - } else { |
|
87 | - $response = 'You are not allowed to speak with me.'; |
|
88 | - } |
|
89 | - |
|
90 | - } |
|
91 | - if($response) { |
|
92 | - $bot->apiRequestJson("sendMessage", array('chat_id' => $update->message->chat->id, "text" => $response)); |
|
93 | - } |
|
94 | - } |
|
95 | - } |
|
96 | - } |
|
97 | - sleep(1); |
|
98 | - } |
|
99 | - } |
|
50 | + //Telegram command |
|
51 | + switch($message) { |
|
52 | + case '/start': $response='I am JarvisPHP, a private bot. \u1F510'; break; |
|
53 | + case '/info': $response='I am JarvisPHP, a private bot. \u1F510'; break; |
|
54 | + case '/register': |
|
55 | + $response='Ok, i registered your ID in registerIdLog.log'; |
|
56 | + file_put_contents('TelegramBot/registerIdLog.log', '['.date('Y-m-d H:i:s').'] ID:'.$update->message->from->id . '; FIRSTNAME:'. $update->message->from->first_name . '; LASTNAME:'. $update->message->from->last_name. '; USERNAME:'. $update->message->from->username.PHP_EOL , FILE_APPEND | LOCK_EX); |
|
57 | + break; |
|
58 | + case '/say': $response='Use /say "sentence" (without quotes) to make JarvisPHP speak a sentence.'; break; |
|
59 | + } |
|
60 | + |
|
61 | + //"Say" Telegram command |
|
62 | + if(preg_match('$^/say (.+)$', $message, $matches)) { |
|
63 | + if($matches) { |
|
64 | + if(in_array($update->message->chat->id, $allowedClientIdList)) { |
|
65 | + //Redirect message to JarvisPhp |
|
66 | + $JarvisResponse = GenericCurl::exec(_JARVISPHP_URL.'/say', array('sentence'=>$matches[1])); |
|
67 | + |
|
68 | + $response = $JarvisResponse->answer; |
|
69 | + } else { |
|
70 | + $response = 'You are not allowed to speak with me.'; |
|
71 | + } |
|
72 | + } |
|
73 | + } |
|
74 | + |
|
75 | + //Encode emoji |
|
76 | + $response = preg_replace_callback('/\\\\u([0-9a-fA-F]+)/', function ($match) { |
|
77 | + return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($match[1]))); |
|
78 | + }, $response); |
|
79 | + |
|
80 | + } else { |
|
81 | + if(in_array($update->message->chat->id, $allowedClientIdList)) { |
|
82 | + //Redirect message to JarvisPhp |
|
83 | + $JarvisResponse = GenericCurl::exec(_JARVISPHP_URL.'/answer', array('command'=>$message, 'tts' => 'None_tts')); |
|
84 | + |
|
85 | + $response = $JarvisResponse->answer; |
|
86 | + } else { |
|
87 | + $response = 'You are not allowed to speak with me.'; |
|
88 | + } |
|
89 | + |
|
90 | + } |
|
91 | + if($response) { |
|
92 | + $bot->apiRequestJson("sendMessage", array('chat_id' => $update->message->chat->id, "text" => $response)); |
|
93 | + } |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | + sleep(1); |
|
98 | + } |
|
99 | + } |
|
100 | 100 | } |
101 | 101 | \ No newline at end of file |
@@ -5,10 +5,10 @@ |
||
5 | 5 | * m1, m2, ... m8 male voices |
6 | 6 | * f1, f2, f3, f4 female voices |
7 | 7 | */ |
8 | -define('_ESPEAK_VOICE','m2'); |
|
8 | +define('_ESPEAK_VOICE', 'm2'); |
|
9 | 9 | |
10 | 10 | //Language of text-to-speech |
11 | 11 | define('_ESPEAK_LANGUAGE', _LANGUAGE); |
12 | 12 | |
13 | 13 | //Amplitude (espeak -a <amplitude>) |
14 | -define('_ESPEAK_AMPLITUDE','100'); |
|
15 | 14 | \ No newline at end of file |
15 | +define('_ESPEAK_AMPLITUDE', '100'); |
|
16 | 16 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | //Set locale |
7 | -define('_LANGUAGE','en'); |
|
7 | +define('_LANGUAGE', 'en'); |
|
8 | 8 | |
9 | 9 | //Command session timeout, in seconds |
10 | 10 | define('_COMMAND_SESSION_TIMEOUT', 30); |
@@ -13,4 +13,4 @@ discard block |
||
13 | 13 | define('_JARVIS_TTS', 'None_tts'); |
14 | 14 | |
15 | 15 | //Define system's name |
16 | -define('_SYSTEM_NAME','JarvisPhp'); |
|
17 | 16 | \ No newline at end of file |
17 | +define('_SYSTEM_NAME', 'JarvisPhp'); |
|
18 | 18 | \ No newline at end of file |