@@ -119,7 +119,7 @@ public function __construct($bot_token, $log_errors = true, array $proxy = [])
119
119
*/
120
120
public function endpoint ($ api , array $ content , $ post = true )
121
121
{
122
- $ url = 'https://api.telegram.org/bot ' . $ this ->bot_token . '/ ' . $ api ;
122
+ $ url = 'https://api.telegram.org/bot ' . $ this ->bot_token . '/ ' . $ api ;
123
123
if ($ post ) {
124
124
$ reply = $ this ->sendAPIRequest ($ url , $ content );
125
125
} else {
@@ -741,7 +741,7 @@ public function stopPoll(array $content)
741
741
*/
742
742
public function downloadFile ($ telegram_file_path , $ local_file_path )
743
743
{
744
- $ file_url = 'https://api.telegram.org/file/bot ' . $ this ->bot_token . '/ ' . $ telegram_file_path ;
744
+ $ file_url = 'https://api.telegram.org/file/bot ' . $ this ->bot_token . '/ ' . $ telegram_file_path ;
745
745
$ in = fopen ($ file_url , 'rb ' );
746
746
$ out = fopen ($ local_file_path , 'wb ' );
747
747
@@ -845,6 +845,7 @@ public function Caption()
845
845
public function ChatID ()
846
846
{
847
847
$ chat = $ this ->Chat ();
848
+
848
849
return $ chat ['id ' ];
849
850
}
850
851
@@ -1151,10 +1152,10 @@ public function messageFromGroupTitle()
1151
1152
public function buildKeyBoard (array $ options , $ onetime = false , $ resize = false , $ selective = true )
1152
1153
{
1153
1154
$ replyMarkup = [
1154
- 'keyboard ' => $ options ,
1155
+ 'keyboard ' => $ options ,
1155
1156
'one_time_keyboard ' => $ onetime ,
1156
- 'resize_keyboard ' => $ resize ,
1157
- 'selective ' => $ selective ,
1157
+ 'resize_keyboard ' => $ resize ,
1158
+ 'selective ' => $ selective ,
1158
1159
];
1159
1160
$ encodedMarkup = json_encode ($ replyMarkup , true );
1160
1161
@@ -1197,8 +1198,7 @@ public function buildInlineKeyboardButton(
1197
1198
$ switch_inline_query_current_chat = null ,
1198
1199
$ callback_game = '' ,
1199
1200
$ pay = ''
1200
- )
1201
- {
1201
+ ) {
1202
1202
$ replyMarkup = [
1203
1203
'text ' => $ text ,
1204
1204
];
@@ -1230,8 +1230,8 @@ public function buildInlineKeyboardButton(
1230
1230
public function buildKeyboardButton ($ text , $ request_contact = false , $ request_location = false )
1231
1231
{
1232
1232
$ replyMarkup = [
1233
- 'text ' => $ text ,
1234
- 'request_contact ' => $ request_contact ,
1233
+ 'text ' => $ text ,
1234
+ 'request_contact ' => $ request_contact ,
1235
1235
'request_location ' => $ request_location ,
1236
1236
];
1237
1237
@@ -1248,7 +1248,7 @@ public function buildKeyBoardHide($selective = true)
1248
1248
{
1249
1249
$ replyMarkup = [
1250
1250
'remove_keyboard ' => true ,
1251
- 'selective ' => $ selective ,
1251
+ 'selective ' => $ selective ,
1252
1252
];
1253
1253
$ encodedMarkup = json_encode ($ replyMarkup , true );
1254
1254
@@ -1264,7 +1264,7 @@ public function buildForceReply($selective = true)
1264
1264
{
1265
1265
$ replyMarkup = [
1266
1266
'force_reply ' => true ,
1267
- 'selective ' => $ selective ,
1267
+ 'selective ' => $ selective ,
1268
1268
];
1269
1269
$ encodedMarkup = json_encode ($ replyMarkup , true );
1270
1270
@@ -1718,74 +1718,92 @@ public function getUpdateType()
1718
1718
$ update = $ this ->data ;
1719
1719
if (isset ($ update ['inline_query ' ])) {
1720
1720
$ this ->update_type = self ::INLINE_QUERY ;
1721
+
1721
1722
return $ this ->update_type ;
1722
1723
}
1723
1724
if (isset ($ update ['callback_query ' ])) {
1724
1725
$ this ->update_type = self ::CALLBACK_QUERY ;
1726
+
1725
1727
return $ this ->update_type ;
1726
1728
}
1727
1729
if (isset ($ update ['edited_message ' ])) {
1728
1730
$ this ->update_type = self ::EDITED_MESSAGE ;
1731
+
1729
1732
return $ this ->update_type ;
1730
1733
}
1731
1734
if (isset ($ update ['message ' ]['text ' ])) {
1732
1735
$ this ->update_type = self ::MESSAGE ;
1736
+
1733
1737
return $ this ->update_type ;
1734
1738
}
1735
1739
if (isset ($ update ['message ' ]['photo ' ])) {
1736
1740
$ this ->update_type = self ::PHOTO ;
1741
+
1737
1742
return $ this ->update_type ;
1738
1743
}
1739
1744
if (isset ($ update ['message ' ]['video ' ])) {
1740
1745
$ this ->update_type = self ::VIDEO ;
1746
+
1741
1747
return $ this ->update_type ;
1742
1748
}
1743
1749
if (isset ($ update ['message ' ]['audio ' ])) {
1744
1750
$ this ->update_type = self ::AUDIO ;
1751
+
1745
1752
return $ this ->update_type ;
1746
1753
}
1747
1754
if (isset ($ update ['message ' ]['voice ' ])) {
1748
1755
$ this ->update_type = self ::VOICE ;
1756
+
1749
1757
return $ this ->update_type ;
1750
1758
}
1751
1759
if (isset ($ update ['message ' ]['contact ' ])) {
1752
1760
$ this ->update_type = self ::CONTACT ;
1761
+
1753
1762
return $ this ->update_type ;
1754
1763
}
1755
1764
if (isset ($ update ['message ' ]['location ' ])) {
1756
1765
$ this ->update_type = self ::LOCATION ;
1766
+
1757
1767
return $ this ->update_type ;
1758
1768
}
1759
1769
if (isset ($ update ['message ' ]['reply_to_message ' ])) {
1760
1770
$ this ->update_type = self ::REPLY ;
1771
+
1761
1772
return $ this ->update_type ;
1762
1773
}
1763
1774
if (isset ($ update ['message ' ]['animation ' ])) {
1764
1775
$ this ->update_type = self ::ANIMATION ;
1776
+
1765
1777
return $ this ->update_type ;
1766
1778
}
1767
1779
if (isset ($ update ['message ' ]['sticker ' ])) {
1768
1780
$ this ->update_type = self ::STICKER ;
1781
+
1769
1782
return $ this ->update_type ;
1770
1783
}
1771
1784
if (isset ($ update ['message ' ]['document ' ])) {
1772
1785
$ this ->update_type = self ::DOCUMENT ;
1786
+
1773
1787
return $ this ->update_type ;
1774
1788
}
1775
1789
if (isset ($ update ['message ' ]['new_chat_member ' ])) {
1776
1790
$ this ->update_type = self ::NEW_CHAT_MEMBER ;
1791
+
1777
1792
return $ this ->update_type ;
1778
1793
}
1779
1794
if (isset ($ update ['message ' ]['left_chat_member ' ])) {
1780
1795
$ this ->update_type = self ::LEFT_CHAT_MEMBER ;
1796
+
1781
1797
return $ this ->update_type ;
1782
1798
}
1783
1799
if (isset ($ update ['my_chat_member ' ])) {
1784
1800
$ this ->update_type = self ::MY_CHAT_MEMBER ;
1801
+
1785
1802
return $ this ->update_type ;
1786
1803
}
1787
1804
if (isset ($ update ['channel_post ' ])) {
1788
1805
$ this ->update_type = self ::CHANNEL_POST ;
1806
+
1789
1807
return $ this ->update_type ;
1790
1808
}
1791
1809
@@ -1795,7 +1813,7 @@ public function getUpdateType()
1795
1813
private function sendAPIRequest ($ url , array $ content , $ post = true )
1796
1814
{
1797
1815
if (isset ($ content ['chat_id ' ])) {
1798
- $ url = $ url . '?chat_id= ' . $ content ['chat_id ' ];
1816
+ $ url = $ url. '?chat_id= ' . $ content ['chat_id ' ];
1799
1817
unset($ content ['chat_id ' ]);
1800
1818
}
1801
1819
$ ch = curl_init ();
@@ -1851,7 +1869,7 @@ private function sendAPIRequest($url, array $content, $post = true)
1851
1869
function curl_file_create ($ filename , $ mimetype = '' , $ postname = '' )
1852
1870
{
1853
1871
return "@ $ filename;filename= "
1854
- . ($ postname ?: basename ($ filename ))
1855
- . ($ mimetype ? ";type= $ mimetype " : '' );
1872
+ .($ postname ?: basename ($ filename ))
1873
+ .($ mimetype ? ";type= $ mimetype " : '' );
1856
1874
}
1857
1875
}
0 commit comments