@@ -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 | |
@@ -127,8 +127,9 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | $this->processPayload($result); |
| 129 | 129 | |
| 130 | - if ($sleep !== false) |
|
| 131 | - sleep($sleep); |
|
| 130 | + if ($sleep !== false) { |
|
| 131 | + sleep($sleep); |
|
| 132 | + } |
|
| 132 | 133 | } |
| 133 | 134 | } |
| 134 | 135 | |
@@ -282,8 +283,9 @@ discard block |
||
| 282 | 283 | */ |
| 283 | 284 | public function getChatId($chat_id = null) { |
| 284 | 285 | try { |
| 285 | - if ($chat_id) |
|
| 286 | - return $chat_id; |
|
| 286 | + if ($chat_id) { |
|
| 287 | + return $chat_id; |
|
| 288 | + } |
|
| 287 | 289 | |
| 288 | 290 | if( isset($this->result->message) ) { |
| 289 | 291 | return $this->result->message->chat->id; |