Skip to content

Commit a1f2064

Browse files
committed
Add the new methods sendMediaGroup, editMessageLiveLocation, stopMessageLiveLocation, setChatStickerSet and deleteChatStickerSet.
Update doc
1 parent d1a0451 commit a1f2064

File tree

2 files changed

+221
-12
lines changed

2 files changed

+221
-12
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# TelegramBotPHP
2-
[![API](https://img.shields.io/badge/Telegram%20Bot%20API-August%2023%2C%202017-36ade1.svg)](https://core.telegram.org/bots/api)
2+
[![API](https://img.shields.io/badge/Telegram%20Bot%20API-November%2017%2C%202017-36ade1.svg)](https://core.telegram.org/bots/api)
33
![PHP](https://img.shields.io/badge/php-%3E%3D5.3-8892bf.svg)
44
![CURL](https://img.shields.io/badge/cURL-required-green.svg)
55

@@ -8,7 +8,7 @@
88
[![StyleCI](https://styleci.io/repos/38492095/shield?branch=master)](https://styleci.io/repos/38492095)
99

1010
A very simple PHP [Telegram Bot API](https://core.telegram.org/bots).
11-
Compliant with the August 23, 2017 Telegram Bot API update.
11+
Compliant with the November 17, 2017 Telegram Bot API update.
1212

1313
Requirements
1414
---------

Telegram.php

Lines changed: 219 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,12 @@ public function sendVoice(array $content)
613613
* <td>Longitude of location</td>
614614
* </tr>
615615
* <tr>
616+
* <td>live_period</td>
617+
* <td>Integer</td>
618+
* <td>Optional</td>
619+
* <td>Period in seconds for which the location will be updated (see <a href="https://telegram.org/blog/live-locations">Live Locations</a>, should be between 60 and 86400.</td>
620+
* </tr>
621+
* <tr>
616622
* <td>disable_notification</td>
617623
* <td>Boolean</td>
618624
* <td>Optional</td>
@@ -638,7 +644,204 @@ public function sendLocation(array $content)
638644
{
639645
return $this->endpoint('sendLocation', $content);
640646
}
647+
648+
/// Edit Message Live Location
649+
650+
/**
651+
* Use this method to edit live location messages sent by the bot or via the bot (for <a href="https://core.telegram.org/bots/api#inline-mode">inline bots</a>). A location can be edited until its <em>live_period</em> expires or editing is explicitly disabled by a call to <a href="https://core.telegram.org/bots/api#stopmessagelivelocation">stopMessageLiveLocation</a>. On success, if the edited message was sent by the bot, the edited <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned.<br/>Values inside $content:<br/>
652+
* <table>
653+
* <tr>
654+
* <td><strong>Parameters</strong></td>
655+
* <td><strong>Type</strong></td>
656+
* <td><strong>Required</strong></td>
657+
* <td><strong>Description</strong></td>
658+
* </tr>
659+
* <tr>
660+
* <td>chat_id</td>
661+
* <td>Integer or String</td>
662+
* <td>Optional</td>
663+
* <td>Required if <em>inline_message_id</em> is not specified. Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername)</td>
664+
* </tr>
665+
* <tr>
666+
* <td>message_id</td>
667+
* <td>Integer</td>
668+
* <td>Optional</td>
669+
* <td>Required if <em>inline_message_id</em> is not specified. Identifier of the sent message</td>
670+
* </tr>
671+
* <tr>
672+
* <td>inline_message_id</td>
673+
* <td>String</td>
674+
* <td>Optional</td>
675+
* <td>Required if <em>chat_id</em> and <em>message_id</em> are not specified. Identifier of the inline message</td>
676+
* </tr>
677+
* <tr>
678+
* <td>latitude</td>
679+
* <td>Float number</td>
680+
* <td>Yes</td>
681+
* <td>Latitude of new location</td>
682+
* </tr>
683+
* <tr>
684+
* <td>longitude</td>
685+
* <td>Float number</td>
686+
* <td>Yes</td>
687+
* <td>Longitude of new location</td>
688+
* </tr>
689+
* <tr>
690+
* <td>reply_markup</td>
691+
* <td><a href="https://core.telegram.org/bots/api#inlinekeyboardmarkup">InlineKeyboardMarkup</a></td>
692+
* <td>Optional</td>
693+
* <td>A JSON-serialized object for a new <a href="https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating">inline keyboard</a>.</td>
694+
* </tr>
695+
* </table>
696+
* \param $content the request parameters as array
697+
* \return the JSON Telegram's reply.
698+
*/
699+
public function editMessageLiveLocation(array $content)
700+
{
701+
return $this->endpoint('editMessageLiveLocation', $content);
702+
}
703+
704+
/// Stop Message Live Location
705+
706+
/**
707+
* Use this method to stop updating a live location message sent by the bot or via the bot (for <a href="https://core.telegram.org/bots/api#inline-mode">inline bots</a>) before <em>live_period</em> expires. On success, if the message was sent by the bot, the sent <a href="https://core.telegram.org/bots/api#message">Message</a> is returned, otherwise <em>True</em> is returned.<br/>Values inside $content:<br/>
708+
* <table>
709+
* <tr>
710+
* <td><strong>Parameters</strong></td>
711+
* <td><strong>Type</strong></td>
712+
* <td><strong>Required</strong></td>
713+
* <td><strong>Description</strong></td>
714+
* </tr>
715+
* <tr>
716+
* <td>chat_id</td>
717+
* <td>Integer or String</td>
718+
* <td>Optional</td>
719+
* <td>Required if <em>inline_message_id</em> is not specified. Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername)</td>
720+
* </tr>
721+
* <tr>
722+
* <td>message_id</td>
723+
* <td>Integer</td>
724+
* <td>Optional</td>
725+
* <td>Required if <em>inline_message_id</em> is not specified. Identifier of the sent message</td>
726+
* </tr>
727+
* <tr>
728+
* <td>inline_message_id</td>
729+
* <td>String</td>
730+
* <td>Optional</td>
731+
* <td>Required if <em>chat_id</em> and <em>message_id</em> are not specified. Identifier of the inline message</td>
732+
* </tr>
733+
* <tr>
734+
* <td>reply_markup</td>
735+
* <td><a href="https://core.telegram.org/bots/api#inlinekeyboardmarkup">InlineKeyboardMarkup</a></td>
736+
* <td>Optional</td>
737+
* <td>A JSON-serialized object for a new <a href="https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating">inline keyboard</a>.</td>
738+
* </tr>
739+
* </table>
740+
* \param $content the request parameters as array
741+
* \return the JSON Telegram's reply.
742+
*/
743+
public function stopMessageLiveLocation(array $content)
744+
{
745+
return $this->endpoint('stopMessageLiveLocation', $content);
746+
}
747+
748+
/// Set Chat Sticker Set
749+
750+
/**
751+
* Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field <em>can_set_sticker_set</em> optionally returned in <a href="https://core.telegram.org/bots/api#getchat">getChat</a> requests to check if the bot can use this method. Returns <em>True</em> on success.<br/>Values inside $content:<br/>
752+
* <table>
753+
* <tr>
754+
* <td><strong>Parameters</strong></td>
755+
* <td><strong>Type</strong></td>
756+
* <td><strong>Required</strong></td>
757+
* <td><strong>Description</strong></td>
758+
* </tr>
759+
* <tr>
760+
* <td>chat_id</td>
761+
* <td>Integer or String</td>
762+
* <td>Yes</td>
763+
* <td>Unique identifier for the target chat or username of the target supergroup (in the format <code>@supergroupusername</code>)</td>
764+
* </tr>
765+
* </table>
766+
* \param $content the request parameters as array
767+
* \return the JSON Telegram's reply.
768+
*/
769+
public function setChatStickerSet(array $content)
770+
{
771+
return $this->endpoint('setChatStickerSet', $content);
772+
}
773+
774+
775+
/// Delete Chat Sticker Set
776+
777+
/**
778+
* Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Use the field <em>can_set_sticker_set</em> optionally returned in <a href="https://core.telegram.org/bots/api#getchat">getChat</a> requests to check if the bot can use this method. Returns <em>True</em> on success.<br/>Values inside $content:<br/>
779+
* <table>
780+
* <tr>
781+
* <td><strong>Parameters</strong></td>
782+
* <td><strong>Type</strong></td>
783+
* <td><strong>Required</strong></td>
784+
* <td><strong>Description</strong></td>
785+
* </tr>
786+
* <tr>
787+
* <td>chat_id</td>
788+
* <td>Integer or String</td>
789+
* <td>Yes</td>
790+
* <td>Unique identifier for the target chat or username of the target supergroup (in the format <code>@supergroupusername</code>)</td>
791+
* </tr>
792+
* </table>
793+
* \param $content the request parameters as array
794+
* \return the JSON Telegram's reply.
795+
*/
796+
public function deleteChatStickerSet(array $content)
797+
{
798+
return $this->endpoint('deleteChatStickerSet', $content);
799+
}
800+
801+
/// Send Media Group
641802

803+
/**
804+
* Use this method to send a group of photos or videos as an album. On success, an array of the sent <a href="https://core.telegram.org/bots/api#message">Messages</a> is returned.<br/>Values inside $content:<br/>
805+
* <table>
806+
* <tr>
807+
* <td><strong>Parameters</strong></td>
808+
* <td><strong>Type</strong></td>
809+
* <td><strong>Required</strong></td>
810+
* <td><strong>Description</strong></td>
811+
* </tr>
812+
* <tr>
813+
* <td>chat_id</td>
814+
* <td>Integer or String</td>
815+
* <td>Yes</td>
816+
* <td>Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername)</td>
817+
* </tr>
818+
* <tr>
819+
* <td>media</td>
820+
* <td>Array of <a href="https://core.telegram.org/bots/api#inputmedia">InputMedia</a></td>
821+
* <td>Yes</td>
822+
* <td>A JSON-serialized array describing photos and videos to be sent, must include 2–10 items</td>
823+
* </tr>
824+
* <tr>
825+
* <td>disable_notification</td>
826+
* <td>Boolean</td>
827+
* <td>Optional</td>
828+
* <td>Sends the messages <a href="https://telegram.org/blog/channels-2-0#silent-messages">silently</a>. Users will receive a notification with no sound.</td>
829+
* </tr>
830+
* <tr>
831+
* <td>reply_to_message_id</td>
832+
* <td>Integer</td>
833+
* <td>Optional</td>
834+
* <td>If the messages are a reply, ID of the original message</td>
835+
* </tr>
836+
* </table>
837+
* \param $content the request parameters as array
838+
* \return the JSON Telegram's reply.
839+
*/
840+
public function sendMediaGroup(array $content)
841+
{
842+
return $this->endpoint('sendMediaGroup', $content);
843+
}
844+
642845
/// Send Venue
643846

644847
/**
@@ -1909,6 +2112,12 @@ public function buildForceReply($selective = true)
19092112
* <td>Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)</td>
19102113
* </tr>
19112114
* <tr>
2115+
* <td>provider_data</td>
2116+
* <td>String</td>
2117+
* <td>Optional</td>
2118+
* <td>JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.</td>
2119+
* </tr>
2120+
* <tr>
19122121
* <td>photo_url</td>
19132122
* <td>String</td>
19142123
* <td>Optional</td>
@@ -2431,7 +2640,7 @@ public function setChatDescription(array $content)
24312640
* <td>chat_id</td>
24322641
* <td>Integer or String</td>
24332642
* <td>Yes</td>
2434-
* <td>Unique identifier for the target chat or username of the target supergroup (in the format <code>@supergroupusername</code>)</td>
2643+
* <td>Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername)</td>
24352644
* </tr>
24362645
* <tr>
24372646
* <td>message_id</td>
@@ -2469,7 +2678,7 @@ public function pinChatMessage(array $content)
24692678
* <td>chat_id</td>
24702679
* <td>Integer or String</td>
24712680
* <td>Yes</td>
2472-
* <td>Unique identifier for the target chat or username of the target supergroup (in the format <code>@supergroupusername</code>)</td>
2681+
* <td>Unique identifier for the target chat or username of the target channel (in the format \c \@channelusername)</td>
24732682
* </tr>
24742683
* </table>
24752684
* \param $content the request parameters as array
@@ -2525,9 +2734,9 @@ public function getStickerSet(array $content)
25252734
* </tr>
25262735
* <tr>
25272736
* <td>png_sticker</td>
2528-
* <td><a href="#inputfile">InputFile</a></td>
2737+
* <td><a href="https://core.telegram.org/bots/api#inputfile">InputFile</a></td>
25292738
* <td>Yes</td>
2530-
* <td><strong>Png</strong> image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. <a href="#sending-files">More info on Sending Files »</a></td>
2739+
* <td><strong>Png</strong> image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. <a href="https://core.telegram.org/bots/api#sending-files">More info on Sending Files »</a></td>
25312740
* </tr>
25322741
* </table>
25332742
* \param $content the request parameters as array
@@ -2569,9 +2778,9 @@ public function uploadStickerFile(array $content)
25692778
* </tr>
25702779
* <tr>
25712780
* <td>png_sticker</td>
2572-
* <td><a href="#inputfile">InputFile</a> or String</td>
2781+
* <td><a href="https://core.telegram.org/bots/api#inputfile">InputFile</a> or String</td>
25732782
* <td>Yes</td>
2574-
* <td><strong>Png</strong> image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a <em>file_id</em> as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. <a href="#sending-files">More info on Sending Files »</a></td>
2783+
* <td><strong>Png</strong> image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a <em>file_id</em> as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. <a href="https://core.telegram.org/bots/api#sending-files">More info on Sending Files »</a></td>
25752784
* </tr>
25762785
* <tr>
25772786
* <td>emojis</td>
@@ -2587,7 +2796,7 @@ public function uploadStickerFile(array $content)
25872796
* </tr>
25882797
* <tr>
25892798
* <td>mask_position</td>
2590-
* <td><a href="#maskposition">MaskPosition</a></td>
2799+
* <td><a href="https://core.telegram.org/bots/api#maskposition">MaskPosition</a></td>
25912800
* <td>Optional</td>
25922801
* <td>Position where the mask should be placed on faces</td>
25932802
* </tr>
@@ -2625,9 +2834,9 @@ public function createNewStickerSet(array $content)
26252834
* </tr>
26262835
* <tr>
26272836
* <td>png_sticker</td>
2628-
* <td><a href="#inputfile">InputFile</a> or String</td>
2837+
* <td><a href="https://core.telegram.org/bots/api#inputfile">InputFile</a> or String</td>
26292838
* <td>Yes</td>
2630-
* <td><strong>Png</strong> image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a <em>file_id</em> as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. <a href="#sending-files">More info on Sending Files »</a></td>
2839+
* <td><strong>Png</strong> image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a <em>file_id</em> as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. <a href="https://core.telegram.org/bots/api#sending-files">More info on Sending Files »</a></td>
26312840
* </tr>
26322841
* <tr>
26332842
* <td>emojis</td>
@@ -2637,7 +2846,7 @@ public function createNewStickerSet(array $content)
26372846
* </tr>
26382847
* <tr>
26392848
* <td>mask_position</td>
2640-
* <td><a href="#maskposition">MaskPosition</a></td>
2849+
* <td><a href="https://core.telegram.org/bots/api#maskposition">MaskPosition</a></td>
26412850
* <td>Optional</td>
26422851
* <td>Position where the mask should be placed on faces</td>
26432852
* </tr>

0 commit comments

Comments
 (0)