├── .editorconfig ├── .github └── workflows │ └── notify.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── composer.json ├── readme.md └── src ├── Constants ├── ChatActions.php ├── ChatMemberStatus.php ├── ChatType.php ├── Emojis.php ├── MaskPositionPoint.php ├── MessageEntityTypes.php ├── MessageTypes.php ├── ParseModes.php ├── PassportSources.php ├── PassportTypes.php ├── PollType.php ├── TelegramLimits.php └── UpdateTypes.php ├── TelegramBot.php ├── TelegramException.php ├── TelegramHelper.php └── Types ├── Animation.php ├── Audio.php ├── BotCommand.php ├── BotCommandScopeAllChatAdministrators.php ├── BotCommandScopeAllGroupChats.php ├── BotCommandScopeAllPrivateChats.php ├── BotCommandScopeChat.php ├── BotCommandScopeChatAdministrators.php ├── BotCommandScopeChatMember.php ├── BotCommandScopeDefault.php ├── CallbackQuery.php ├── Chat.php ├── ChatInviteLink.php ├── ChatLocation.php ├── ChatMember.php ├── ChatMemberAdministrator.php ├── ChatMemberBanned.php ├── ChatMemberLeft.php ├── ChatMemberMember.php ├── ChatMemberOwner.php ├── ChatMemberRestricted.php ├── ChatMemberUpdated.php ├── ChatPermissions.php ├── ChatPhoto.php ├── ChosenInlineResult.php ├── Contact.php ├── Dice.php ├── Document.php ├── EncryptedCredentials.php ├── EncryptedPassportElement.php ├── File.php ├── ForceReply.php ├── Game.php ├── GameHighScore.php ├── InlineKeyboardButton.php ├── InlineKeyboardMarkup.php ├── InlineQuery.php ├── InlineQueryResultArticle.php ├── InlineQueryResultAudio.php ├── InlineQueryResultCachedAudio.php ├── InlineQueryResultCachedDocument.php ├── InlineQueryResultCachedGif.php ├── InlineQueryResultCachedMpeg4Gif.php ├── InlineQueryResultCachedPhoto.php ├── InlineQueryResultCachedSticker.php ├── InlineQueryResultCachedVideo.php ├── InlineQueryResultCachedVoice.php ├── InlineQueryResultContact.php ├── InlineQueryResultDocument.php ├── InlineQueryResultGame.php ├── InlineQueryResultGif.php ├── InlineQueryResultLocation.php ├── InlineQueryResultMpeg4Gif.php ├── InlineQueryResultPhoto.php ├── InlineQueryResultVenue.php ├── InlineQueryResultVideo.php ├── InlineQueryResultVoice.php ├── InputContactMessageContent.php ├── InputInvoiceMessageContent.php ├── InputLocationMessageContent.php ├── InputMediaAnimation.php ├── InputMediaAudio.php ├── InputMediaDocument.php ├── InputMediaPhoto.php ├── InputMediaVideo.php ├── InputTextMessageContent.php ├── InputVenueMessageContent.php ├── Invoice.php ├── KeyboardButton.php ├── KeyboardButtonPollType.php ├── LabeledPrice.php ├── Location.php ├── LoginUrl.php ├── MaskPosition.php ├── Message.php ├── MessageAutoDeleteTimerChanged.php ├── MessageEntity.php ├── MessageId.php ├── OrderInfo.php ├── PassportData.php ├── PassportElementErrorDataField.php ├── PassportElementErrorFile.php ├── PassportElementErrorFiles.php ├── PassportElementErrorFrontSide.php ├── PassportElementErrorReverseSide.php ├── PassportElementErrorSelfie.php ├── PassportElementErrorTranslationFile.php ├── PassportElementErrorTranslationFiles.php ├── PassportElementErrorUnspecified.php ├── PassportFile.php ├── PhotoSize.php ├── Poll.php ├── PollAnswer.php ├── PollOption.php ├── PreCheckoutQuery.php ├── ProximityAlertTriggered.php ├── ReplyKeyboardMarkup.php ├── ReplyKeyboardRemove.php ├── Response.php ├── ResponseParameters.php ├── ShippingAddress.php ├── ShippingOption.php ├── ShippingQuery.php ├── Sticker.php ├── StickerSet.php ├── SuccessfulPayment.php ├── Update.php ├── User.php ├── UserProfilePhotos.php ├── Venue.php ├── Video.php ├── VideoNote.php ├── Voice.php ├── VoiceChatEnded.php ├── VoiceChatParticipantsInvited.php ├── VoiceChatScheduled.php ├── VoiceChatStarted.php └── WebhookInfo.php /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | max_line_length = 120 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [*.{yml, yaml}] 16 | indent_size = 2 17 | 18 | [*.php] 19 | ij_php_align_key_value_pairs = false 20 | ij_php_comma_after_last_array_element = true 21 | ij_php_keep_indents_on_empty_lines = false 22 | ij_php_else_if_style = combine 23 | ij_php_keep_blank_lines_in_code = 1 24 | ij_php_concat_spaces = false 25 | ij_php_blank_lines_before_return_statement = 1 26 | ij_php_space_before_short_closure_left_parenthesis = true 27 | -------------------------------------------------------------------------------- /.github/workflows/notify.yml: -------------------------------------------------------------------------------- 1 | name: Notify 2 | on: 3 | push: 4 | branches: 5 | - master 6 | release: 7 | types: [published] 8 | 9 | jobs: 10 | notify: 11 | name: Notify via Telegram 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Send message to Telegram 15 | uses: Lukasss93/telegram-action@v1.1 16 | env: 17 | TELEGRAM_TOKEN: ${{ secrets.telegram_token }} 18 | TELEGRAM_CHAT: ${{ secrets.telegram_chat }} 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | vendor/ 3 | test/ 4 | composer.lock 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## v1.14.1 - 2021-09-07 8 | ### Fixed 9 | - Fixed php version + updated jsonmapper version 10 | - Removed composer.lock from git 11 | 12 | ## v1.14 - 2021-07-25 13 | ### Changed 14 | - Updated to Telegram Bot API 5.3 15 | 16 | ## v1.13 - 2021-04-26 17 | ### Changed 18 | - Updated to Telegram Bot API 5.2 19 | 20 | ## v1.12.1 - 2021-03-10 21 | ### Fixed 22 | - Fix missing types 23 | 24 | ## v1.12 - 2021-03-10 25 | ### Changed 26 | - Updated to Telegram Bot API 5.1 27 | 28 | ## v1.11 - 2020-11-10 29 | ### Changed 30 | - Updated to Telegram Bot API 5.0 31 | 32 | ## v1.10.1 - 2020-07-29 33 | ### Fixed 34 | - Scalar return values not supported when mapping objects 35 | 36 | ## v1.10 - 2020-07-21 37 | ### Added 38 | - Added `getFrom()` method to Update object to get the sender 39 | 40 | ## v1.9 - 2020-06-05 41 | ### Changed 42 | - Updated to Telegram Bot API 4.9 43 | 44 | ## v1.8 - 2020-04-26 45 | ### Added 46 | - Added the ability to get an inexistent property from an object 47 | 48 | ### Changed 49 | - Updated to Telegram Bot API 4.8 50 | 51 | ### Fixed 52 | - Fixed `mb_str_split` method warning in PHP 7.4 53 | ### Changed 54 | - Updated to Telegram Bot API 4.8 55 | 56 | ### Fixed 57 | - Fixed `mb_str_split` method warning in PHP 7.4 58 | 59 | ## v1.7.1 - 2020-03-31 60 | ### Changed 61 | - Updated to Telegram Bot API 4.7 62 | - Improved PHPDocs 63 | 64 | ## v1.7 - 2020-03-18 65 | ### Changed 66 | - Added support for **PHP 7.2+** 67 | - Updated to Telegram Bot API 4.5 + 4.6 68 | - Improved PHPDocs 69 | - Updated code indentation to PSR-12 standard 70 | - Updated LICENSE file 71 | - Updated CHANGELOG file using [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 72 | 73 | ### Fixed 74 | - Missing fields in some types 75 | 76 | ### Removed 77 | - Dropped support for **PHP 5.6** 78 | 79 | ## v1.6.14 - 2019-08-01 80 | ### Changed 81 | - Updated to Telegram Bot API 4.4 82 | 83 | ## v1.6.13 - 2019-06-01 84 | ### Changed 85 | - Updated to Telegram Bot API 4.3 86 | - Updated PHPDocs 87 | 88 | ### Fixed 89 | - Missing `poll` variable inside Message class 90 | 91 | ## v1.6.12 - 2019-04-14 92 | ### Changed 93 | - Updated to Telegram Bot API 4.2 94 | 95 | ## v1.6.11 - 2018-08-28 96 | ### Added 97 | - Added `clearUpdates()` custom method (it's an alias for `getUpdates(-1)`) 98 | - Added `TelegramLimits` class constants to get the download/upload file limit 99 | 100 | ### Changed 101 | - Updated to Telegram Bot API 4.1 102 | - You can now pass an interger to `getArgs()` method to get the string at the array index position 103 | 104 | ## v1.6.10 - 2018-08-22 105 | ### Fixed 106 | - Fixed `JsonMapper Exception` PHPDoc message in all methods 107 | - Fixed exception using `sendMessage()` method + split message feature with unicode strings 108 | - Missing php extensions in *composer.json* file 109 | 110 | ## v1.6.9 - 2018-07-28 111 | ### Added 112 | - Added *MessageEntityTypes*, *PassportSources*, *PassportTypes* classes in constants namespace 113 | 114 | ### Changed 115 | - Updated to Telegram Bot API 4.0 116 | - Updated LICENSE file 117 | - Updated PHPDocs in methods 118 | - Updated code indentation 119 | - Replaced whitespaces with tabs 120 | 121 | ### Removed 122 | - Removed unused variables 123 | 124 | ### Fixed 125 | - Fixed JsonMapper Exception `true` type 126 | - Fixed `pay` parameter unused in `buildInlineKeyboardButton()` method 127 | - Missing `allowed_updates` parameter from `getUpdates()` method 128 | 129 | ## v1.6.8 - 2018-04-10 130 | ### Added 131 | - Added `isCommand()` method to Message class 132 | 133 | ### Fixed 134 | - Fixed JsonMapper Exception `true` type 135 | 136 | ## v1.6.7 - 2018-02-14 137 | ### Fixed 138 | - Fixed `uploadStickerFile()` method 139 | 140 | ## v1.6.6 - 2018-02-14 141 | ### Changed 142 | - Updated to Telegram Bot API 3.6 143 | 144 | ## v1.6.5 - 2017-11-20 145 | ### Changed 146 | - Updated to Telegram Bot API 3.5 147 | 148 | ## v1.6.4 - 2017-10-11 149 | ### Changed 150 | - Updated to Telegram Bot API 3.4 151 | 152 | ## v1.6.3 - 2017-09-21 153 | ### Fixed 154 | - Fixed `getCommand()` method in Message class. 155 | 156 | ## v1.6.2 - 2017-09-17 157 | ### Fixed 158 | - Fixed `getCommand()` method in Message class 159 | 160 | ## v1.6.1 - 2017-09-17 161 | ### Changed 162 | - The `getCommand()` method in Message class now return `null` if `text` property isn't a command 163 | 164 | ## v1.6.0 - 2017-08-23 165 | ### Changed 166 | - Updated to Telegram Bot API 3.3 167 | 168 | ## v1.5.2 - 2017-08-20 169 | ### Changed 170 | - Renamed `curl_file_create_auto_mime()` function in `curl_file_create_automime()` 171 | 172 | ## v1.5.1 - 2017-08-19 173 | ### Fixed 174 | - Fixed `curl_file_create_auto_mime()` function 175 | 176 | ## v1.5.0 - 2017-08-14 177 | ### Added 178 | - Added new `endpoint()` method to call api methods manually 179 | - Added *ChatActions* and *ParseModes* classes in constants namespace 180 | - Added `splitLongMessage` property to allow splitting text with `sendMessage()` method 181 | - Auto split very long text in `sendMessage` method 182 | 183 | ## v1.4.4 - 2017-08-13 184 | ### Added 185 | - Added LICENSE file 186 | - Added TODO list to readme 187 | - Added changelog link to readme 188 | 189 | ### Fixed 190 | - Fixed concatenation error 191 | - Fixed PHPDoc errors 192 | - Fixed TelegramHelper not available globally 193 | 194 | ## v1.4.3 - 2017-08-12 195 | ### Added 196 | - Added `curl_file_create()` helper function 197 | - Added `curl_file_create_auto_mime()` helper function 198 | - Added `is_json()` helper function 199 | 200 | ### Removed 201 | - Removed *aurax-php* library dependence 202 | 203 | ## v1.4.2 - 2017-08-12 204 | ### Added 205 | - Added `getType()` method in Message class 206 | 207 | ### Changed 208 | - Renamed and fixed `getType()` in Update class 209 | 210 | ## v1.4.1 - 2017-08-09 211 | ### Added 212 | - Added `INLINE_QUERY` type to `getUpdateType()` method 213 | 214 | ## v1.4 - 2017-07-21 215 | ### Changed 216 | - Updated to Telegram Bot API 3.2 217 | 218 | ## v1.3 - 2017-06-30 219 | ### Changed 220 | - Updated to Telegram Bot API 3.1 221 | 222 | ## v1.2.3 - 2017-06-12 223 | ### Added 224 | - Added `getUpdateType()` method 225 | - Added TelegramUpdateTypes class for `getUpdateType()` method 226 | - Added curl_file_create_auto_mime() function 227 | 228 | ### Fixed 229 | - Fixed `isForwarded()` method in Message class 230 | 231 | ## v1.2.2 - 2017-06-05 232 | ### Fixed 233 | - Fixed `sendRequest()` phpdoc and post parameters 234 | 235 | ## v1.2.1 - 2017-06-04 236 | ### Added 237 | - Added `isForwarded()` method in Message class 238 | 239 | ## v1.2 - 2017-06-04 240 | ### Changed 241 | - Improved code 242 | 243 | ## v1.1 - 2017-05-20 244 | ### Changed 245 | - Updated to Telegram Bot API 3.0 246 | 247 | ## v1.0 - 2017-01-24 248 | ### Added 249 | - First commit 250 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Luca Patera 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lukasss93/telegrambot-php", 3 | "description": "Framework for Telegram Bot API", 4 | "license": "MIT", 5 | "type": "project", 6 | "authors": [ 7 | { 8 | "name": "Luca Patera", 9 | "email": "lucapatera@outlook.it", 10 | "homepage": "https://www.lucapatera.it/" 11 | } 12 | ], 13 | "require": { 14 | "php": "^7.2|^8.0", 15 | "ext-mbstring": "*", 16 | "ext-curl": "*", 17 | "ext-fileinfo": "*", 18 | "ext-json": "*", 19 | "netresearch/jsonmapper": "^v4.0" 20 | }, 21 | "autoload": { 22 | "psr-4": { 23 | "TelegramBot\\": "src/", 24 | "TelegramBot\\Types\\": "src/Types/", 25 | "TelegramBot\\Constants\\": "src/Constants/" 26 | }, 27 | "files": [ 28 | "src/TelegramHelper.php" 29 | ] 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Constants/ChatActions.php: -------------------------------------------------------------------------------- 1 | code}]: {$this->message}"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/TelegramHelper.php: -------------------------------------------------------------------------------- 1 | 1) { 42 | $return_value = []; 43 | $string_length = mb_strlen($string, 'UTF-8'); 44 | for ($i = 0; $i < $string_length; $i += $split_length) { 45 | $return_value[] = mb_substr($string, $i, $split_length, 'UTF-8'); 46 | } 47 | return $return_value; 48 | } 49 | 50 | return false; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Types/Animation.php: -------------------------------------------------------------------------------- 1 | /. 8 | * It is guaranteed that the link will be valid for at least 1 hour. 9 | * When the link expires, a new one can be requested by calling {@see https://core.telegram.org/bots/api#getfile getFile}. 10 | * Maximum file size to download is 20 MB 11 | * @see https://core.telegram.org/bots/api#file 12 | */ 13 | class File 14 | { 15 | /** 16 | * Identifier for this file 17 | * @var string $file_id 18 | */ 19 | public $file_id; 20 | 21 | /** 22 | * Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file. 23 | * @var string $file_unique_id 24 | */ 25 | public $file_unique_id; 26 | 27 | /** 28 | * Optional. File size, if known 29 | * @var int $file_size 30 | */ 31 | public $file_size; 32 | 33 | /** 34 | * Optional. File path. Use https://api.telegram.org/file/bot/ to get the file. 35 | * @var string $file_path 36 | */ 37 | public $file_path; 38 | } 39 | -------------------------------------------------------------------------------- /src/Types/ForceReply.php: -------------------------------------------------------------------------------- 1 | ” 20 | * to upload a new one using multipart/form-data under name. 21 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 22 | * @var string $media 23 | */ 24 | public $media; 25 | 26 | /** 27 | * Optional. Thumbnail of the file sent; 28 | * can be ignored if thumbnail generation for the file is supported server-side. 29 | * The thumbnail should be in JPEG format and less than 200 kB in size. 30 | * A thumbnail‘s width and height should not exceed 320. 31 | * Ignored if the file is not uploaded using multipart/form-data. 32 | * Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 33 | * “attach://” if the thumbnail was uploaded using multipart/form-data under . 34 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 35 | * @var mixed $thumb 36 | */ 37 | public $thumb; 38 | 39 | /** 40 | * Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing 41 | * @var string $caption 42 | */ 43 | public $caption; 44 | 45 | /** 46 | * Optional. Send Markdown or HTML, if you want Telegram apps to show 47 | * bold, italic, fixed-width text or inline URLs in the media caption. 48 | * @see https://core.telegram.org/bots/api#markdown-style Markdown 49 | * @see https://core.telegram.org/bots/api#html-style HTML 50 | * @see https://core.telegram.org/bots/api#formatting-options bold, italic, fixed-width text or inline URLs 51 | * @var string $parse_mode 52 | */ 53 | public $parse_mode; 54 | 55 | /** 56 | * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode 57 | * @var MessageEntity[] $caption_entities 58 | */ 59 | public $caption_entities; 60 | 61 | /** 62 | * Optional. Video width 63 | * @var int $width 64 | */ 65 | public $width; 66 | 67 | /** 68 | * Optional. Video height 69 | * @var int $height 70 | */ 71 | public $height; 72 | 73 | /** 74 | * Optional. Video duration 75 | * @var int $duration 76 | */ 77 | public $duration; 78 | } 79 | -------------------------------------------------------------------------------- /src/Types/InputMediaAudio.php: -------------------------------------------------------------------------------- 1 | ” 20 | * to upload a new one using multipart/form-data under name. 21 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 22 | * @var string $media 23 | */ 24 | public $media; 25 | 26 | /** 27 | * Optional. Thumbnail of the file sent; 28 | * can be ignored if thumbnail generation for the file is supported server-side. 29 | * The thumbnail should be in JPEG format and less than 200 kB in size. 30 | * A thumbnail‘s width and height should not exceed 320. 31 | * Ignored if the file is not uploaded using multipart/form-data. 32 | * Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 33 | * “attach://” if the thumbnail was uploaded using multipart/form-data under . 34 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 35 | * @var mixed $thumb 36 | */ 37 | public $thumb; 38 | 39 | /** 40 | * Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing 41 | * @var string $caption 42 | */ 43 | public $caption; 44 | 45 | /** 46 | * Optional. Send Markdown or HTML, if you want Telegram apps to show 47 | * bold, italic, fixed-width text or inline URLs in the media caption. 48 | * @see https://core.telegram.org/bots/api#markdown-style Markdown 49 | * @see https://core.telegram.org/bots/api#html-style HTML 50 | * @see https://core.telegram.org/bots/api#formatting-options bold, italic, fixed-width text or inline URLs 51 | * @var string $parse_mode 52 | */ 53 | public $parse_mode; 54 | 55 | /** 56 | * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode 57 | * @var MessageEntity[] $caption_entities 58 | */ 59 | public $caption_entities; 60 | 61 | /** 62 | * Optional. Duration of the audio in seconds 63 | * @var int $duration 64 | */ 65 | public $duration; 66 | 67 | /** 68 | * Optional. Performer of the audio 69 | * @var string $performer 70 | */ 71 | public $performer; 72 | 73 | /** 74 | * Optional. Title of the audio 75 | * @var string $title 76 | */ 77 | public $title; 78 | } 79 | -------------------------------------------------------------------------------- /src/Types/InputMediaDocument.php: -------------------------------------------------------------------------------- 1 | ” 20 | * to upload a new one using multipart/form-data under name. 21 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 22 | * @var string $media 23 | */ 24 | public $media; 25 | 26 | /** 27 | * Optional. Thumbnail of the file sent; 28 | * can be ignored if thumbnail generation for the file is supported server-side. 29 | * The thumbnail should be in JPEG format and less than 200 kB in size. 30 | * A thumbnail‘s width and height should not exceed 320. 31 | * Ignored if the file is not uploaded using multipart/form-data. 32 | * Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 33 | * “attach://” if the thumbnail was uploaded using multipart/form-data under . 34 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 35 | * @var mixed $thumb 36 | */ 37 | public $thumb; 38 | 39 | /** 40 | * Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing 41 | * @var string $caption 42 | */ 43 | public $caption; 44 | 45 | /** 46 | * Optional. Send Markdown or HTML, if you want Telegram apps to show 47 | * bold, italic, fixed-width text or inline URLs in the media caption. 48 | * @see https://core.telegram.org/bots/api#markdown-style Markdown 49 | * @see https://core.telegram.org/bots/api#html-style HTML 50 | * @see https://core.telegram.org/bots/api#formatting-options bold, italic, fixed-width text or inline URLs 51 | * @var string $parse_mode 52 | */ 53 | public $parse_mode; 54 | 55 | /** 56 | * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode 57 | * @var MessageEntity[] $caption_entities 58 | */ 59 | public $caption_entities; 60 | 61 | /** 62 | * Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data. 63 | * Always true, if the document is sent as part of an album. 64 | * @var bool $disable_content_type_detection 65 | */ 66 | public $disable_content_type_detection; 67 | } 68 | -------------------------------------------------------------------------------- /src/Types/InputMediaPhoto.php: -------------------------------------------------------------------------------- 1 | ” 20 | * to upload a new one using multipart/form-data under name. 21 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 22 | * @var string $media 23 | */ 24 | public $media; 25 | 26 | /** 27 | * Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing 28 | * @var string $caption 29 | */ 30 | public $caption; 31 | 32 | /** 33 | * Optional. Send Markdown or HTML, if you want Telegram apps to show 34 | * bold, italic, fixed-width text or inline URLs in the media caption. 35 | * @see https://core.telegram.org/bots/api#markdown-style Markdown 36 | * @see https://core.telegram.org/bots/api#html-style HTML 37 | * @see https://core.telegram.org/bots/api#formatting-options bold, italic, fixed-width text or inline URLs 38 | * @var string $parse_mode 39 | */ 40 | public $parse_mode; 41 | 42 | /** 43 | * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode 44 | * @var MessageEntity[] $caption_entities 45 | */ 46 | public $caption_entities; 47 | } 48 | -------------------------------------------------------------------------------- /src/Types/InputMediaVideo.php: -------------------------------------------------------------------------------- 1 | ” 20 | * to upload a new one using multipart/form-data under name. 21 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 22 | * @var string $media 23 | */ 24 | public $media; 25 | 26 | /** 27 | * Optional. Thumbnail of the file sent; 28 | * can be ignored if thumbnail generation for the file is supported server-side. 29 | * The thumbnail should be in JPEG format and less than 200 kB in size. 30 | * A thumbnail‘s width and height should not exceed 320. 31 | * Ignored if the file is not uploaded using multipart/form-data. 32 | * Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass 33 | * “attach://” if the thumbnail was uploaded using multipart/form-data under . 34 | * @see https://core.telegram.org/bots/api#sending-files More info on Sending Files 35 | * @var mixed $thumb 36 | */ 37 | public $thumb; 38 | 39 | /** 40 | * Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing 41 | * @var string $caption 42 | */ 43 | public $caption; 44 | 45 | /** 46 | * Optional. Send Markdown or HTML, if you want Telegram apps to show 47 | * bold, italic, fixed-width text or inline URLs in the media caption. 48 | * @see https://core.telegram.org/bots/api#markdown-style Markdown 49 | * @see https://core.telegram.org/bots/api#html-style HTML 50 | * @see https://core.telegram.org/bots/api#formatting-options bold, italic, fixed-width text or inline URLs 51 | * @var string $parse_mode 52 | */ 53 | public $parse_mode; 54 | 55 | /** 56 | * Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode 57 | * @var MessageEntity[] $caption_entities 58 | */ 59 | public $caption_entities; 60 | 61 | /** 62 | * Optional. Video width 63 | * @var int $width 64 | */ 65 | public $width; 66 | 67 | /** 68 | * Optional. Video height 69 | * @var int $height 70 | */ 71 | public $height; 72 | 73 | /** 74 | * Optional. Video duration 75 | * @var int $duration 76 | */ 77 | public $duration; 78 | 79 | /** 80 | * Optional. Pass True, if the uploaded video is suitable for streaming 81 | * @var bool $supports_streaming 82 | */ 83 | public $supports_streaming; 84 | } 85 | -------------------------------------------------------------------------------- /src/Types/InputTextMessageContent.php: -------------------------------------------------------------------------------- 1 | message !== null) { 118 | return UpdateTypes::MESSAGE; 119 | } 120 | 121 | if($this->edited_message !== null) { 122 | return UpdateTypes::EDITED_MESSAGE; 123 | } 124 | 125 | if($this->channel_post !== null) { 126 | return UpdateTypes::CHANNEL_POST; 127 | } 128 | 129 | if($this->edited_channel_post !== null) { 130 | return UpdateTypes::EDITED_CHANNEL_POST; 131 | } 132 | 133 | if($this->inline_query !== null) { 134 | return UpdateTypes::INLINE_QUERY; 135 | } 136 | 137 | if($this->chosen_inline_result !== null) { 138 | return UpdateTypes::CHOSEN_INLINE_RESULT; 139 | } 140 | 141 | if($this->callback_query !== null) { 142 | return UpdateTypes::CALLBACK_QUERY; 143 | } 144 | 145 | if($this->shipping_query !== null) { 146 | return UpdateTypes::SHIPPING_QUERY; 147 | } 148 | 149 | if($this->pre_checkout_query !== null) { 150 | return UpdateTypes::PRE_CHECKOUT_QUERY; 151 | } 152 | 153 | if($this->poll !== null) { 154 | return UpdateTypes::POLL; 155 | } 156 | 157 | if($this->poll_answer !== null) { 158 | return UpdateTypes::POLL_ANSWER; 159 | } 160 | 161 | if($this->my_chat_member !== null) { 162 | return UpdateTypes::MY_CHAT_MEMBER; 163 | } 164 | 165 | if($this->chat_member !== null) { 166 | return UpdateTypes::CHAT_MEMBER; 167 | } 168 | 169 | return false; 170 | } 171 | 172 | /** 173 | * Get the sender User 174 | * @return User|null 175 | */ 176 | public function getFrom() 177 | { 178 | if($this->message!==null){ 179 | return $this->message->from??null; 180 | } 181 | 182 | if($this->edited_message!==null){ 183 | return $this->edited_message->from??null; 184 | } 185 | 186 | if($this->channel_post!==null){ 187 | return $this->channel_post->from??null; 188 | } 189 | 190 | if($this->edited_channel_post!==null){ 191 | return $this->edited_channel_post->from??null; 192 | } 193 | 194 | if($this->inline_query!==null){ 195 | return $this->inline_query->from; 196 | } 197 | 198 | if($this->chosen_inline_result!==null){ 199 | return $this->chosen_inline_result->from; 200 | } 201 | 202 | if($this->callback_query!==null){ 203 | return $this->callback_query->from; 204 | } 205 | 206 | if($this->shipping_query!==null){ 207 | return $this->shipping_query->from; 208 | } 209 | 210 | if($this->pre_checkout_query!==null){ 211 | return $this->pre_checkout_query->from; 212 | } 213 | 214 | if($this->poll_answer!==null){ 215 | return $this->poll_answer->user; 216 | } 217 | 218 | return null; 219 | } 220 | } 221 | -------------------------------------------------------------------------------- /src/Types/User.php: -------------------------------------------------------------------------------- 1 |