@@ -23,7 +23,7 @@ all sorts to bring automated interactions to the mobile platform. This
23
23
Bot aims to provide a platform where one could simply write a plugin
24
24
and have interactions in a matter of minutes.
25
25
The Bot can:
26
- - retrive update with webhook and by getUpdate methods.
26
+ - retrive update with webhook and getUpdate methods.
27
27
- supports all types and methods according to Telegram API (2015 October 8).
28
28
- handle commads in chat with other bots.
29
29
@@ -215,12 +215,49 @@ All types implemented according to Telegram API (2015 October 8).
215
215
216
216
### Methods New!
217
217
All methods implemented according to Telegram API (2015 October 8).
218
- TODO example to use methods
218
+ ###Send Photo
219
+ To send a local photo provide the file path as second param:
219
220
220
221
``` php
221
- $result = Request::sendPhoto($data,'image.jpg');
222
+ $data['chat_id'] = $chat_id;
223
+ $result = Request::sendPhoto($data,$this->telegram->getUploadPath().'/'.'image.jpg');
222
224
```
223
225
226
+ If you know the file_id of a previously uploaded file, just provide it in the fist param:
227
+
228
+ ``` php
229
+ $data['chat_id'] = $chat_id;
230
+ $data['photo'] = $file_id;
231
+ $result = Request::sendPhoto($data);
232
+ ```
233
+
234
+ * sendAudio* , * sendDocument* , * sendSticker* , * sendVideo* and * sendVoice* works in the same way.
235
+ See * ImageCommand.php* for a full example.
236
+ ####Send Chat Action
237
+
238
+ ``` php
239
+ Request::sendChatAction(['chat_id' => $chat_id, 'action' => 'typing']);
240
+ ```
241
+ ####getUserProfilePhoto
242
+ Retrieve the user photo, see the * WhoamiCommand.php* for a full example.
243
+
244
+ ####GetFile and dowloadFile
245
+ Get the file path and download it, see the * WhoamiCommand.php* for a full example.
246
+
247
+ #### Send message to all active chats
248
+ To do this you have to enable the Mysql connection.
249
+ Here's an example of use:
250
+
251
+ ``` php
252
+ $results = $telegram->sendToActiveChats(
253
+ 'sendMessage', //callback function to execute (see Request.php methods)
254
+ array('text'=>'Hey! Checkout the new feature!!'), //Param to evaluate the request
255
+ true, //Send to chats (group chat)
256
+ true, //Send to users (single chat)
257
+ null, //'yyyy-mm-dd hh:mm:ss' date range from
258
+ null //'yyyy-mm-dd hh:mm:ss' date range to
259
+ );
260
+ ```
224
261
225
262
## Utilis
226
263
### MySQL storage (Recomended)
@@ -291,21 +328,8 @@ array('google_api_key'=>'your_google_api_key_here'));
291
328
### Upload and Download directory
292
329
You can overwrite the default Upload and download directory with:
293
330
``` php
294
-
295
- ```
296
- ### Send message to all active chats
297
- To do this you have to enable the Mysql connection.
298
- Here's an example of use:
299
-
300
- ``` php
301
- $results = $telegram->sendToActiveChats(
302
- 'sendMessage', //callback function to execute (see Request.php methods)
303
- array('text'=>'Hey! Checkout the new feature!!'), //Param to evaluate the request
304
- true, //Send to chats (group chat)
305
- true, //Send to users (single chat)
306
- null, //'yyyy-mm-dd hh:mm:ss' date range from
307
- null //'yyyy-mm-dd hh:mm:ss' date range to
308
- );
331
+ $telegram->setDownloadPath("yourpath/Download");
332
+ $telegram->setUploadPath("yourpath../Upload");
309
333
```
310
334
311
335
### Logging
0 commit comments