@@ -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 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | private $answer = ''; |
14 | 14 | private $choosen_plugin = 'none'; |
15 | 15 | |
16 | - public function __construct($answer, $choosen_plugin='none', $success=false) { |
|
16 | + public function __construct($answer, $choosen_plugin = 'none', $success = false) { |
|
17 | 17 | $this->answer = $answer; |
18 | 18 | $this->choosen_plugin = $choosen_plugin; |
19 | 19 | $this->success = $success; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | public static function speak($sentence) { |
14 | 14 | |
15 | 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')) { |
|
16 | + if (!file_exists(_JARVISPHP_ROOT_PATH.'/Speakers/cache/'.md5($sentence).'.mp3')) { |
|
17 | 17 | $curl = curl_init(); |
18 | 18 | |
19 | 19 | curl_setopt_array($curl, array( |
@@ -9,11 +9,11 @@ |
||
9 | 9 | use JarvisPHP\TelegramBot\JarvisPHPTelegramBot; |
10 | 10 | |
11 | 11 | //Load allowedClientIdList |
12 | -if(file_exists('TelegramBot/allowedClientIdList.json')) { |
|
12 | +if (file_exists('TelegramBot/allowedClientIdList.json')) { |
|
13 | 13 | $json_config = json_decode(file_get_contents('TelegramBot/allowedClientIdList.json')); |
14 | 14 | } |
15 | 15 | |
16 | -if($json_config) { |
|
16 | +if ($json_config) { |
|
17 | 17 | //Let's start the bot |
18 | 18 | JarvisPHPTelegramBot::run($json_config->allowedClientIdList); |
19 | 19 | } |
20 | 20 | \ No newline at end of file |