diff --git a/API_10.1_FEATURES.md b/API_10.1_FEATURES.md new file mode 100644 index 00000000..a86f907c --- /dev/null +++ b/API_10.1_FEATURES.md @@ -0,0 +1,66 @@ +# ميزات تحديث Bot API 10.1 + +يدعم هذا التحديث ميزات الإصدار 10.1 من واجهة برمجة تطبيقات تيليجرام للبوتات (Telegram Bot API) الصادر في 11 يونيو 2026. + +## 1. الرسائل الغنية (Rich Messages) +تمت إضافة دعم للرسائل الغنية مما يتيح للبوتات إرسال نصوص منظمة وبث ردود تم إنشاؤها عبر الذكاء الاصطناعي مع تنسيقات غنية وسلسة. + +- **الكيانات الجديدة:** إضافة فئات تمثل تنسيقات النصوص الغنية (مثل `RichTextBold`، `RichTextItalic`، `RichTextUrl` والمزيد) وكتل الرسائل (مثل `RichBlockParagraph`، `RichBlockTable`، `RichBlockVideo` والمزيد). +- **إرسال رسائل غنية:** استخدام `Request::sendRichMessage` و `Request::sendRichMessageDraft`. + +**مثال تطبيقي:** +```php +use Longman\TelegramBot\Request; + +$response = Request::sendRichMessage([ + 'chat_id' => $chat_id, + 'rich_message' => [ + 'type' => 'rich_message', + 'blocks' => [ + [ + 'type' => 'rich_block_paragraph', + 'text' => [ + 'type' => 'rich_text_bold', + 'text' => 'مرحباً بك في ميزة الرسائل الغنية!' + ] + ] + ] + ] +]); +``` + +- **تعديل رسائل غنية:** يمكنك الآن تمرير `rich_message` إلى وظيفة `editMessageText` لتعديل الرسائل لتصبح رسائل غنية. + +## 2. استعلامات طلب الانضمام (Join Request Queries) +تم توفير دعم لاستعلامات طلب الانضمام التي تقدم تفاعلات متقدمة عند انضمام المستخدمين. + +- يمكن التحقق مما إذا كان المستخدم يدعم هذه الاستعلامات من خلال حقل `supports_join_request_queries` في كائن `User`. +- يمكن تحديد البوت الحارس للدردشة من خلال الحقل `guard_bot` في كائن `ChatFullInfo`. +- للرد على استعلام: +```php +use Longman\TelegramBot\Request; + +$result = Request::answerChatJoinRequestQuery([ + 'query_id' => $query_id, + 'text' => 'تمت الموافقة على طلبك بنجاح!' +]); +``` + +## 3. الوسائط المتصلة بالاستفتاءات (Poll Media) +تمت إضافة فئات جديدة مثل `Link` لدعم تضمين الروابط المباشرة في وسائط الاستفتاء (`PollMedia`). + +```php +use Longman\TelegramBot\Request; + +Request::sendPoll([ + 'chat_id' => $chat_id, + 'question' => 'ما رأيك في هذا الرابط؟', + 'options' => [['text' => 'ممتاز'], ['text' => 'جيد']], + 'media' => [ + 'type' => 'link', + 'url' => 'https://example.com' + ] +]); +``` + +تم تحديث المكتبة بالكامل لدعم هذه الكيانات والأساليب بطريقة سهلة ومدمجة. diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ee3cf44..0130fa50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,10 +10,19 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ## [1.2.0] - 2026-03-01 ### Notes - [:ledger: View file changes][1.2.0] +- [API 10.1 Features Documentation](API_10.1_FEATURES.md) - [API 9.4 and 9.5 Features Documentation](API_9.4_9.5_FEATURES.md) - [API 9.3 Features Documentation](API_9.3_FEATURES.md) -- Support for Telegram Bot API 7.4 through 9.5. -### Added +- Support for Telegram Bot API 7.4 through 10.1. +### Added +- **Bot API 10.1:** + - Support for Rich Messages via `RichMessage`, `RichText`, and `RichBlock`. + - Added methods `sendRichMessage` and `sendRichMessageDraft`. + - Support for `rich_message` in `editMessageText`. + - Added support for Join Request Queries: `answerChatJoinRequestQuery` and `sendChatJoinRequestWebApp`. + - Added `supports_join_request_queries` to `User`. + - Added `guard_bot` to `ChatFullInfo`. + - Added `Link` and `InputMediaLink` for polls. - **Bot API 9.5:** - New `MessageEntity` type `date_time` with `unix_time` and `date_time_format`. - Support for `sendMessageDraft` for all bots. diff --git a/src/Entities/ChatFullInfo.php b/src/Entities/ChatFullInfo.php index 46c9d552..2c6ddfb8 100644 --- a/src/Entities/ChatFullInfo.php +++ b/src/Entities/ChatFullInfo.php @@ -26,6 +26,7 @@ * @method int getUnrestrictBoostCount() Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. * @method int getMessageAutoDeleteTime() Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat. * @method bool getHasAggressiveAntiSpamEnabled() Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. + * @method User getGuardBot() Optional. The bot that is serving as the guard bot for the chat. Returned only in getChat. * @method bool getHasHiddenMembers() Optional. True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in getChat. * @method bool getHasProtectedContent() Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat. * @method bool getHasVisibleHistory() Optional. True, if new chat members will have access to old messages; available only to chat administrators. @@ -55,6 +56,7 @@ protected function subEntities(): array 'rating' => UserRating::class, 'unique_gift_colors' => UniqueGiftColors::class, 'accepted_gift_types' => AcceptedGiftTypes::class, + 'guard_bot' => User::class, 'first_profile_audio' => Audio::class, ]); } diff --git a/src/Entities/ChatJoinRequest.php b/src/Entities/ChatJoinRequest.php index 5d2c3433..894e91a7 100644 --- a/src/Entities/ChatJoinRequest.php +++ b/src/Entities/ChatJoinRequest.php @@ -13,6 +13,7 @@ * @method User getFrom() User that sent the join request * @method int getUserChatId() Identifier of a private chat with the user who sent the join request. * @method int getDate() Date the request was sent in Unix time + * @method string getQueryId() Optional. Unique identifier for the join request query. * @method string getBio() Optional. Bio of the user. * @method ChatInviteLink getInviteLink() Optional. Chat invite link that was used by the user to send the join request */ diff --git a/src/Entities/InputMedia/InputMediaLink.php b/src/Entities/InputMedia/InputMediaLink.php new file mode 100644 index 00000000..da17ec14 --- /dev/null +++ b/src/Entities/InputMedia/InputMediaLink.php @@ -0,0 +1,17 @@ + [RichBlock::class], + ]; + } +} diff --git a/src/Entities/InputRichMessage.php b/src/Entities/InputRichMessage.php new file mode 100644 index 00000000..f1fa0311 --- /dev/null +++ b/src/Entities/InputRichMessage.php @@ -0,0 +1,25 @@ + [RichBlock::class], + ]; + } +} diff --git a/src/Entities/Link.php b/src/Entities/Link.php index 649de229..dd48bb45 100644 --- a/src/Entities/Link.php +++ b/src/Entities/Link.php @@ -1,26 +1,14 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace Longman\TelegramBot\Entities; /** * Class Link * - * This object represents a link. - * * @link https://core.telegram.org/bots/api#link * * @method string getUrl() URL of the link */ class Link extends Entity { - } diff --git a/src/Entities/Message.php b/src/Entities/Message.php index f8641430..ced0bb52 100644 --- a/src/Entities/Message.php +++ b/src/Entities/Message.php @@ -119,6 +119,7 @@ * @method VideoChatEnded getVideoChatEnded() Optional. Service message: voice chat ended * @method VideoChatParticipantsInvited getVideoChatParticipantsInvited() Optional. Service message: new participants invited to a voice chat * @method WebAppData getWebAppData() Optional. Service message: data sent by a Web App + * @method RichMessage getRichMessage() Optional. Rich formatted message. * @method InlineKeyboard getReplyMarkup() Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. * @method string getBusinessConnectionId() Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message is business_message. * @method User getSenderBusinessBot() Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the business account. @@ -217,6 +218,7 @@ protected function subEntities(): array 'video_chat_ended' => VideoChatEnded::class, 'video_chat_participants_invited' => VideoChatParticipantsInvited::class, 'web_app_data' => WebAppData::class, + 'rich_message' => RichMessage::class, 'reply_markup' => InlineKeyboard::class, 'chat_background_set' => ChatBackground::class, 'checklist' => Checklist::class, diff --git a/src/Entities/RichBlock/RichBlock.php b/src/Entities/RichBlock/RichBlock.php new file mode 100644 index 00000000..343fdf57 --- /dev/null +++ b/src/Entities/RichBlock/RichBlock.php @@ -0,0 +1,36 @@ + [RichBlock::class], + ]; + } +} diff --git a/src/Entities/RichText/RichText.php b/src/Entities/RichText/RichText.php new file mode 100644 index 00000000..db2d9568 --- /dev/null +++ b/src/Entities/RichText/RichText.php @@ -0,0 +1,36 @@ +