Update to Bot API 6.7 #3

Closed
opened 2023-04-22 02:47:21 +00:00 by netkas · 49 comments
netkas commented 2023-04-22 02:47:21 +00:00 (Migrated from git-old.n64.cc)

Alas! Just as the last update was completed, a new one is rolled out, let's get to work.

  • Added support for launching Web Apps from inline query results by replacing the parameters switch_pm_text and switch_pm_parameter of the method answerInlineQuery with the parameter button of type InlineQueryResultsButton.
  • Added the field web_app_name to the class WriteAccessAllowed.
  • Added the field switch_inline_query_chosen_chat of the type SwitchInlineQueryChosenChat to the class InlineKeyboardButton, which allows bots to switch to inline mode in a chosen chat of the given type.
  • Added the field via_chat_folder_invite_link to the class ChatMemberUpdated.
  • Added the ability to set different bot names for different user languages using the method setMyName.
  • Added the ability to get the current bot name in the given language as the class BotName using the method getMyName.
  • Added the ability to change bot settings from the bot's profile in official Telegram apps, including the ability to set animated profile photos.
  • Added the ability to specify custom emoji entities using HTML and MarkdownV2 formatting options for bots that purchased additional usernames on Fragment.
Alas! Just as the last update was completed, a new one is rolled out, let's get to work. - [ ] Added support for launching [Web Apps](https://core.telegram.org/bots/webapps) from inline query results by replacing the parameters _switch_pm_text_ and _switch_pm_parameter_ of the method [answerInlineQuery](https://core.telegram.org/bots/api#answerinlinequery) with the parameter button of type [InlineQueryResultsButton](https://core.telegram.org/bots/api#inlinequeryresultsbutton). - [ ] Added the field _web_app_name_ to the class [WriteAccessAllowed](https://core.telegram.org/bots/api#writeaccessallowed). - [ ] Added the field _switch_inline_query_chosen_chat_ of the type [SwitchInlineQueryChosenChat](https://core.telegram.org/bots/api#switchinlinequerychosenchat) to the class [InlineKeyboardButton](https://core.telegram.org/bots/api#inlinekeyboardbutton), which allows bots to switch to inline mode in a chosen chat of the given type. - [x] Added the field _via_chat_folder_invite_link_ to the class [ChatMemberUpdated](https://core.telegram.org/bots/api#chatmemberupdated). - [ ] Added the ability to set different bot names for different user languages using the method [setMyName](https://core.telegram.org/bots/api#setmyname). - [ ] Added the ability to get the current bot name in the given language as the class [BotName](https://core.telegram.org/bots/api#botname) using the method [getMyName](https://core.telegram.org/bots/api#getmyname). - [x] ~~Added the ability to change bot settings from the bot's profile in official Telegram apps, including the ability to set animated profile photos.~~ - [ ] Added the ability to specify custom emoji entities using [HTML](https://core.telegram.org/bots/api#html-style) and [MarkdownV2](https://core.telegram.org/bots/api#markdownv2-style) formatting options for bots that purchased additional usernames on [Fragment](https://fragment.com/).
netkas commented 2023-04-22 02:47:22 +00:00 (Migrated from git-old.n64.cc)

assigned to @netkas

assigned to @netkas
netkas commented 2023-04-22 03:55:31 +00:00 (Migrated from git-old.n64.cc)

mentioned in issue #4

mentioned in issue #4
netkas commented 2023-04-23 18:50:25 +00:00 (Migrated from git-old.n64.cc)

Re-working the mess Telegram has made with their documentation, one reference question in regards to the difference between Inline objects and cached inline objects: https://t.me/tdlibchat/71120

Re-working the mess Telegram has made with their documentation, one reference question in regards to the difference between Inline objects and cached inline objects: https://t.me/tdlibchat/71120
netkas commented 2023-04-23 20:55:43 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InputMessageContent > InputTextMessageContent to represent the content of a text message to be sent as the result of an inline query.

Added object `\TgBotLib\Objects\Telegram\InputMessageContent > InputTextMessageContent` to represent the content of a text message to be sent as the result of an inline query.
netkas commented 2023-04-23 20:55:52 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InputMessageContent > InputLocationMessageContent to represent the content of a location message to be sent as the result of an inline query.

Added object `\TgBotLib\Objects\Telegram\InputMessageContent > InputLocationMessageContent` to represent the content of a location message to be sent as the result of an inline query.
netkas commented 2023-04-23 20:55:57 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InputMessageContent > InputVenueMessageContent to represent the content of a venue message to be sent as the result of an inline query.

Added object `\TgBotLib\Objects\Telegram\InputMessageContent > InputVenueMessageContent` to represent the content of a venue message to be sent as the result of an inline query.
netkas commented 2023-04-23 20:56:03 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InputMessageContent > InputContactMessageContent to represent the content of a contact message to be sent as the result of an inline query.

Added object `\TgBotLib\Objects\Telegram\InputMessageContent > InputContactMessageContent` to represent the content of a contact message to be sent as the result of an inline query.
netkas commented 2023-04-23 20:56:09 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InputMessageContent > InputInvoiceMessageContent to represent the content of an invoice message to be sent as the result of an inline query.

Added object `\TgBotLib\Objects\Telegram\InputMessageContent > InputInvoiceMessageContent` to represent the content of an invoice message to be sent as the result of an inline query.
netkas commented 2023-04-23 20:56:13 +00:00 (Migrated from git-old.n64.cc)

Added new exception class NotImplementedException to represent the case when a method is not implemented yet or the method is not applicable to the current object.

Added new exception class `NotImplementedException` to represent the case when a method is not implemented yet or the method is not applicable to the current object.
netkas commented 2023-04-23 20:56:19 +00:00 (Migrated from git-old.n64.cc)

Refactored InputMessageContent types to its own namespace so InputMessageContent can always return the correct InputMessageContent object type when calling fromArray()

Refactored InputMessageContent types to its own namespace so InputMessageContent can always return the correct InputMessageContent object type when calling `fromArray()`
netkas commented 2023-04-23 20:56:26 +00:00 (Migrated from git-old.n64.cc)

Added methods \TgBotLib\Objects\Telegram\InlineKeyboardButton::setUrl, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setText, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackData,
\TgBotLib\Objects\Telegram\InlineKeyboardButton::setWebApp, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setLoginUrl,
\TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQuery, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQueryCurrentChat,
\TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackGame, \TgBotLib\Objects\Telegram\InlineKeyboardButton::setPay
to \TgBotLib\Objects\Telegram\InlineKeyboardButton

Added methods `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setUrl`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setText`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackData`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setWebApp`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setLoginUrl`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQuery`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setSwitchInlineQueryCurrentChat`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setCallbackGame`, `\TgBotLib\Objects\Telegram\InlineKeyboardButton::setPay` to `\TgBotLib\Objects\Telegram\InlineKeyboardButton`
netkas commented 2023-04-23 20:56:34 +00:00 (Migrated from git-old.n64.cc)

Added methods \TgBotLib\Objects\Telegram\InlineKeyboardMarkup::removeRow & \TgBotLib\Objects\Telegram\InlineKeyboardMarkup::addRow to \TgBotLib\Objects\Telegram\InlineKeyboardMarkup

Added methods `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::removeRow` & `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup::addRow` to `\TgBotLib\Objects\Telegram\InlineKeyboardMarkup`
netkas commented 2023-04-23 21:05:45 +00:00 (Migrated from git-old.n64.cc)

An update to an issue related to the Telegram API Docs.

In question to https://core.telegram.org/bots/api#inlinequeryresult (InlineQueryResult)

The object has multiple representation types indicated by the type property that is available in all these object types.

However, for cached items they're represented as unique object types but I don't see an easy way for a bot to easily determine if the object is a cache object or not, because as documented for example

https://core.telegram.org/bots/api#inlinequeryresultvideo (InlineQueryResultVideo) must contain a type "video" but

https://core.telegram.org/bots/api#inlinequeryresultcachedvideo (InlineQueryResultCachedVideo) contains the same type

So my question is how does the client tell it's a cache object?

No response, but found a solution!

photo_2023-04-23_16-58-40

As presented in this table,
Blue = Unique by priority
Green = Required
Yellow = Optional

According to the documentation, each object type of InputMessageContent (https://core.telegram.org/bots/api#inputmessagecontent) contains different object structures with no type to differentiate them from each other, the only way to do this is by checking for properties that should always be present in some of these object types.

So for example,

Priority 1 - InputInvoiceMessageContent - Check for provider_token

Priority 2 - InputContactMessageContent - Check for phone_number

Priority 3 - InputVenueMessageContent - Check for address

Priority 4 - InputTextMessageContent - Check for message_text

Priority 5 - InputLocationMessageContent - Check for latitude and longitude

The priority is important, as some objects for example InputLocationMessageContent & InputVenueMessageContent both contains required property values latitude and longitude as required. If for any reason Telegram changes this, it may break the check.

If all fails, assume it's InputTextMessageContent and blame Telegram

An update to an issue related to the Telegram API Docs. > In question to https://core.telegram.org/bots/api#inlinequeryresult (**InlineQueryResult**) > > The object has multiple representation types indicated by the `type` property that is available in all these object types. > > However, for cached items they're represented as unique object types but I don't see an easy way for a bot to easily determine if the object is a cache object or not, because as documented for example > > https://core.telegram.org/bots/api#inlinequeryresultvideo (**InlineQueryResultVideo**) must contain a type "video" but > > https://core.telegram.org/bots/api#inlinequeryresultcachedvideo (**InlineQueryResultCachedVideo**) contains the same type > > So my question is how does the client tell it's a cache object? No response, but found a solution! ![photo_2023-04-23_16-58-40](/uploads/d2145311f733c972aabd1ac589fbacc2/photo_2023-04-23_16-58-40.jpg) > As presented in this table, > _Blue = Unique by priority_ > _Green = Required_ > _Yellow = Optional_ > > According to the documentation, each object type of [InputMessageContent](https://core.telegram.org/bots/api#inputmessagecontent) (https://core.telegram.org/bots/api#inputmessagecontent) contains different object structures with no type to differentiate them from each other, the only way to do this is by checking for properties that should always be present in some of these object types. > > So for example, > > Priority 1 - **InputInvoiceMessageContent** - Check for _provider_token_ > > Priority 2 - **InputContactMessageContent** - Check for _phone_number_ > > Priority 3 - **InputVenueMessageContent** - Check for _address_ > > Priority 4 - **InputTextMessageContent** - Check for _message_text_ > > Priority 5 - **InputLocationMessageContent** - Check for _latitude_ and _longitude_ > > The priority is important, as some objects for example **InputLocationMessageContent** & **InputVenueMessageContent** both contains required property values latitude and longitude as required. If for any reason Telegram changes this, it may break the check. > > If all fails, assume it's **InputTextMessageContent** and blame Telegram
netkas commented 2023-04-23 21:34:58 +00:00 (Migrated from git-old.n64.cc)

Added method \TgBotLib\Objects\Telegram\WebAppInfo::setUrl to \TgBotLib\Objects\Telegram\WebAppInfo

Added method `\TgBotLib\Objects\Telegram\WebAppInfo::setUrl` to `\TgBotLib\Objects\Telegram\WebAppInfo`
netkas commented 2023-04-23 21:35:02 +00:00 (Migrated from git-old.n64.cc)

Added methods \TgBotLib\Classes\Validate::url, \TgBotLib\Classes\Validate::length, & \TgBotLib\Classes\Validate::isHttps to \TgBotLib\Classes\Validate

Added methods `\TgBotLib\Classes\Validate::url`, `\TgBotLib\Classes\Validate::length`, & `\TgBotLib\Classes\Validate::isHttps` to `\TgBotLib\Classes\Validate`
netkas commented 2023-04-23 21:46:23 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit f518ca0030

mentioned in commit f518ca0030804734001afcde2949c109efeaf8f9
netkas commented 2023-04-23 22:37:56 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultArticle, see InlineQueryResultArticle for more information.

Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultArticle`, see [InlineQueryResultArticle](https://core.telegram.org/bots/api#inlinequeryresultarticle) for more information.
netkas commented 2023-04-23 22:38:01 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultPhoto, see InlineQueryResultPhoto for more information.

Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultPhoto`, see [InlineQueryResultPhoto](https://core.telegram.org/bots/api#inlinequeryresultphoto) for more information.
netkas commented 2023-04-23 22:38:07 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGif, see InlineQueryResultGif for more information.

Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultGif`, see [InlineQueryResultGif](https://core.telegram.org/bots/api#inlinequeryresultgif) for more information.
netkas commented 2023-04-23 22:38:10 +00:00 (Migrated from git-old.n64.cc)

Added abstract class \TgBotLib\Abstracts\ThumbnailMimeType to represent the mime type of thumbnail, photo, or a file / sticker thumbnail.

Added abstract class `\TgBotLib\Abstracts\ThumbnailMimeType` to represent the mime type of thumbnail, photo, or a file / sticker thumbnail.
netkas commented 2023-04-23 22:38:15 +00:00 (Migrated from git-old.n64.cc)

Added object \TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultMpeg4Gif, see InlineQueryResultMpeg4Gif for more information.

Added object `\TgBotLib\Objects\Telegram\InlineQueryResult\InlineQueryResultMpeg4Gif`, see [InlineQueryResultMpeg4Gif](https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif) for more information.
netkas commented 2023-04-23 22:40:56 +00:00 (Migrated from git-old.n64.cc)

Added field via_chat_folder_invite_link to \TgBotLib\Objects\Telegram\ChatMemberUpdated to represent the invite link, which was used by the user to join the chat; for joining by invite link events only.

Added field `via_chat_folder_invite_link` to `\TgBotLib\Objects\Telegram\ChatMemberUpdated` to represent the invite link, which was used by the user to join the chat; for joining by invite link events only.
netkas commented 2023-04-23 22:41:00 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 277a33f2d3

mentioned in commit 277a33f2d3ef668044908e29b4b0cd26af15d835
netkas commented 2023-04-23 22:41:21 +00:00 (Migrated from git-old.n64.cc)

marked the checklist item Added the field via_chat_folder_invite_link to the class ChatMemberUpdated. as completed

marked the checklist item **Added the field _via_chat_folder_invite_link_ to the class [ChatMemberUpdated](https://core.telegram.org/bots/api#chatmemberupdated).** as completed
netkas commented 2023-04-23 22:58:49 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 41c1d0fc4c

mentioned in commit 41c1d0fc4c661875df866f941a0b12f7b49f9a9b
netkas commented 2023-04-24 00:25:50 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit b1db812097

mentioned in commit b1db812097994f13fffbc357132ff05de45661a4
netkas commented 2023-04-24 00:49:45 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit d14ee4eae4

mentioned in commit d14ee4eae47d171305105796ba69ce56ebfe1a90
netkas commented 2023-04-24 01:07:17 +00:00 (Migrated from git-old.n64.cc)

Done for the day, what's next?

Done for the day, what's next? - [x] ~~Implement [InlineQueryResultLocation](https://core.telegram.org/bots/api#inlinequeryresultlocation)~~ - [x] ~~Implement [InlineQueryResultVenue](https://core.telegram.org/bots/api#inlinequeryresultvenue)~~ - [x] ~~Implement [InlineQueryResultContact](https://core.telegram.org/bots/api#inlinequeryresultcontact)~~ - [x] I~~mplement [InlineQueryResultDocument](https://core.telegram.org/bots/api#inlinequeryresultdocument)~~ - [ ] Revise the code further to see what type if input objects should be implemented and how they should be applied to methods - [ ] Finish implementing missing methods
netkas commented 2023-04-24 01:08:11 +00:00 (Migrated from git-old.n64.cc)

changed the description

changed the description
netkas commented 2023-04-24 01:08:18 +00:00 (Migrated from git-old.n64.cc)

marked the checklist item Added the ability to change bot settings from the bot's profile in official Telegram apps, including the ability to set animated profile photos. as completed

marked the checklist item **~~Added the ability to change bot settings from the bot's profile in official Telegram apps, including the ability to set animated profile photos.~~** as completed
netkas commented 2023-04-24 18:01:43 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 05b877d38a

mentioned in commit 05b877d38a24af44a6520dacbd3bcd9b6c3fad74
netkas commented 2023-04-24 18:27:39 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 144095b228

mentioned in commit 144095b22824feec57f0e6817c6219d79a5deee9
netkas commented 2023-04-24 20:20:31 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 89b240f2eb

mentioned in commit 89b240f2ebe9db52ded379ffa4915bc63615636f
netkas commented 2023-04-24 20:20:31 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 61249cb18d

mentioned in commit 61249cb18dbb92e5d300b9f30433dda71c065ebf
netkas commented 2023-04-24 23:14:53 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit c0b25c7b0e

mentioned in commit c0b25c7b0e843fabb01fac4c7a67f5281dae7cf8
netkas commented 2023-04-24 23:14:53 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 6fb6f74406

mentioned in commit 6fb6f744060c690a1ee0b84cb0a7fac8b287e00a
netkas commented 2023-04-24 23:22:23 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit bcbb742b9f

mentioned in commit bcbb742b9f454c036f0fa0c303d1d711272fa4a9
netkas commented 2023-04-24 23:23:42 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit e463b81948

mentioned in commit e463b81948ce15cee05682fcb843aed1e7f5fa85
netkas commented 2023-04-27 18:23:32 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 581fa42715

mentioned in commit 581fa42715d309c834de4b62f899d9239ec53e53
netkas commented 2023-04-27 18:32:53 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 3d6cc15894

mentioned in commit 3d6cc15894447ad34dcb074ab964274f097e8a80
netkas commented 2023-04-27 20:18:57 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 26c0a197dc

mentioned in commit 26c0a197dc7e749ca157c8f452a909fd1642ea7c
netkas commented 2023-04-27 20:18:57 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 4ce61e5af7

mentioned in commit 4ce61e5af70502d12489f262d788bb687bd4b400
netkas commented 2023-04-27 20:18:57 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit b8d3a20a5c

mentioned in commit b8d3a20a5c8e3a5f4371acbc4c72a094b58738b8
netkas commented 2023-04-27 20:18:57 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit d0219425c1

mentioned in commit d0219425c1f696025aca8c05f84e6ed8524f97d2
netkas commented 2023-04-28 00:42:29 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 3c91058235

mentioned in commit 3c91058235a615c073bbb2ce7e8f3a6f22d3831f
netkas commented 2023-04-30 18:04:07 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 5ce6f737f5

mentioned in commit 5ce6f737f5805e1dcdf8572789659e0f64226a03
netkas commented 2023-04-30 18:04:07 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 2389839a37

mentioned in commit 2389839a37b04c96c3b7e8bea87bd177a95c31a3
netkas commented 2023-04-30 18:04:07 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 40d25a15f1

mentioned in commit 40d25a15f128ef6bf2736a66929fdc00094f79c4
netkas commented 2023-08-09 21:39:55 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 176ea791bf

mentioned in commit 176ea791bf154ca4882cf6c92a08536c8285d3e1
Sign in to join this conversation.
No description provided.