@@ -34,18 +34,19 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function addButton(string $text, string $url = '', string $callback_data = '', string $switch_inline_query = '', string $switch_inline_query_current_chat = '', string $callback_game = ''){ |
| 36 | 36 | $btn['text'] = $text; |
| 37 | - if($url != '') |
|
| 38 | - $btn['url'] = $url; |
|
| 39 | - elseif($callback_data != '') |
|
| 40 | - $btn['callback_data'] = $callback_data; |
|
| 41 | - elseif($switch_inline_query != '') |
|
| 42 | - $btn['switch_inline_query'] = $switch_inline_query; |
|
| 43 | - elseif($switch_inline_query_current_chat != '') |
|
| 44 | - $btn['switch_inline_query_current_chat'] = $switch_inline_query_current_chat; |
|
| 45 | - elseif($callback_game != '') |
|
| 46 | - $btn['callback_game'] = $callback_game; |
|
| 47 | - else |
|
| 48 | - $btn['callback_data'] = $text; |
|
| 37 | + if($url != '') { |
|
| 38 | + $btn['url'] = $url; |
|
| 39 | + } elseif($callback_data != '') { |
|
| 40 | + $btn['callback_data'] = $callback_data; |
|
| 41 | + } elseif($switch_inline_query != '') { |
|
| 42 | + $btn['switch_inline_query'] = $switch_inline_query; |
|
| 43 | + } elseif($switch_inline_query_current_chat != '') { |
|
| 44 | + $btn['switch_inline_query_current_chat'] = $switch_inline_query_current_chat; |
|
| 45 | + } elseif($callback_game != '') { |
|
| 46 | + $btn['callback_game'] = $callback_game; |
|
| 47 | + } else { |
|
| 48 | + $btn['callback_data'] = $text; |
|
| 49 | + } |
|
| 49 | 50 | |
| 50 | 51 | $this->inline_keyboard[$this->current_row][] = $btn; |
| 51 | 52 | |
@@ -116,8 +116,7 @@ discard block |
||
| 116 | 116 | $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 117 | 117 | |
| 118 | 118 | return $conn; |
| 119 | - } |
|
| 120 | - catch(PDOException $e) |
|
| 119 | + } catch(PDOException $e) |
|
| 121 | 120 | { |
| 122 | 121 | return $e->getMessage(); |
| 123 | 122 | } |
@@ -146,8 +145,9 @@ discard block |
||
| 146 | 145 | |
| 147 | 146 | $this->processPayload($result); |
| 148 | 147 | |
| 149 | - if ($sleep !== false) |
|
| 150 | - sleep($sleep); |
|
| 148 | + if ($sleep !== false) { |
|
| 149 | + sleep($sleep); |
|
| 150 | + } |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
@@ -301,8 +301,9 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | public function getChatId($chat_id = null) { |
| 303 | 303 | try { |
| 304 | - if ($chat_id) |
|
| 305 | - return $chat_id; |
|
| 304 | + if ($chat_id) { |
|
| 305 | + return $chat_id; |
|
| 306 | + } |
|
| 306 | 307 | |
| 307 | 308 | if( isset($this->result->message) ) { |
| 308 | 309 | return $this->result->message->chat->id; |