@@ -23,9 +23,7 @@ The Bot can:
2323- retrive update with webhook and getUpdate methods.
2424- supports all types and methods according to Telegram API (2015 October 28).
2525- handle commands in chat with other bots.
26-
27- It is ready for the channels support.
28-
26+ - manage Channel from the bot admin interface (** new!** )
2927
3028## Instructions
3129### Create your first bot
@@ -208,11 +206,12 @@ then run
208206./getUpdateCLI.php
209207```
210208### Types
211- All types implemented according to Telegram API (2015 October 8 ).
209+ All types implemented according to Telegram API (2015 October 28 ).
212210
213- ### Methods New!
214- All methods implemented according to Telegram API (2015 October 8).
215- ###Send Photo
211+ ### Methods
212+ All methods implemented according to Telegram API (2015 October 28).
213+
214+ ####Send Photo
216215To send a local photo provide the file path as second param:
217216
218217``` php
@@ -230,18 +229,18 @@ $result = Request::sendPhoto($data);
230229
231230* sendAudio* , * sendDocument* , * sendSticker* , * sendVideo* and * sendVoice* works in the same way.
232231See * ImageCommand.php* for a full example.
233- ###Send Chat Action
232+ #### Send Chat Action
234233
235234``` php
236235Request::sendChatAction(['chat_id' => $chat_id, 'action' => 'typing']);
237236```
238- ###getUserProfilePhoto
237+ #### getUserProfilePhoto
239238Retrieve the user photo, see the * WhoamiCommand.php* for a full example.
240239
241- ###GetFile and dowloadFile
240+ #### GetFile and dowloadFile
242241Get the file path and download it, see the * WhoamiCommand.php* for a full example.
243242
244- ### Send message to all active chats
243+ #### Send message to all active chats
245244To do this you have to enable the Mysql connection.
246245Here's an example of use:
247246
@@ -263,8 +262,8 @@ in commands, create database and import *structure.sql* and enable
263262Mysql support after object creation and BEFORE handle method:
264263
265264``` php
266- $credentials = array( 'host'=>'localhost', 'user'=>'dbuser',
267- 'password'=>'dbpass', 'database'=>'dbname') ;
265+ $credentials = [ 'host'=>'localhost', 'user'=>'dbuser',
266+ 'password'=>'dbpass', 'database'=>'dbname'] ;
268267
269268$telegram->enableMySQL($credentials);
270269```
@@ -273,6 +272,11 @@ You can set a custom prefix to all the tables while you are enabling Mysql:
273272``` php
274273$telegram->enableMySQL($credentials, $BOT_NAME.'_');
275274```
275+ Consider to use the utf8mb4 branch if you find some special characters problems.
276+
277+ ### Channels Support
278+ All methods implemented can be used to manage channels.
279+ (** new!** ) With admin interface you can manage your channel directly with your bot private chat.
276280
277281### Commands
278282The bot is able to recognise commands in chat with multiple bot (/command@mybot ).
@@ -301,11 +305,19 @@ $telegram->addCommandsPath($COMMANDS_FOLDER);
301305
302306Inside * examples/Commands/* there are some sample that show how to use types.
303307
308+ #### Commands Configuration
309+ With this method you can set some command specified parameters, for
310+ example, google geocode/timezone api key for date command:
311+ ``` php
312+ $telegram->setCommandConfig('date',
313+ ['google_api_key'=>'your_google_api_key_here']);
314+ ```
315+
304316### Admin Commands
305317Enabling this feature, the admin bot can perform some super user command like:
306318- Send message to all chats * /sendtoall*
307319- List all the chats started with the bot * /chats*
308-
320+ - Send a message to a channel * /sendtochannel * (NEW! see below how to configure it)
309321You can specify one or more admin with this option:
310322
311323``` php
@@ -315,21 +327,25 @@ Telegram user id can be retrieved with the command **/whoami**.
315327Admin commands are stored in * src/Admin/* folder.
316328To know all the commands avaiable type ** /help** .
317329
318- ### Commands Configuration
319- With this method you can set some command specified parameters, for
320- example, google geocode/timezone api key for date command:
330+ #### Channel Administration (NEW!)
331+ Follow those steps:
332+ - Add your bot as channel administrator, this can be done with any telegram client.
333+ - Enable admin interface for your user as explained in the admin section above.
334+ - Enter your channel name as a param for the sendtoall command:
321335``` php
322- $telegram->setCommandConfig('date',
323- array('google_api_key'=>'your_google_api_key_here'));
336+ $telegram->setCommandConfig('sendtochannel', ['your_channel'=>'@type_here_your_channel']);
324337```
325- ### Upload and Download directory
338+ - Enjoy!
339+
340+ ### Upload and Download directory path
326341You can overwrite the default Upload and Download directory with:
327342``` php
328343$telegram->setDownloadPath("yourpath/Download");
329344$telegram->setUploadPath("yourpath../Upload");
330345```
331346###Unset Webhook
332347Edit * example/unset.php* with your credential and execute it.
348+
333349### Logging
334350Thrown Exception are stored in * TelegramException.log* file (in the base directory).
335351
0 commit comments