Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions API_10.1_FEATURES.md
Original file line number Diff line number Diff line change
@@ -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'
]
]);
```

تم تحديث المكتبة بالكامل لدعم هذه الكيانات والأساليب بطريقة سهلة ومدمجة.
13 changes: 11 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/Entities/ChatFullInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
]);
}
Expand Down
1 change: 1 addition & 0 deletions src/Entities/ChatJoinRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
17 changes: 17 additions & 0 deletions src/Entities/InputMedia/InputMediaLink.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace Longman\TelegramBot\Entities\InputMedia;

use Longman\TelegramBot\Entities\Entity;

/**
* Class InputMediaLink
*
* @link https://core.telegram.org/bots/api#inputmedialink
*
* @method string getType() Type of the result, must be link
* @method string getUrl() URL of the link
*/
class InputMediaLink extends Entity implements InputMedia
{
}
26 changes: 26 additions & 0 deletions src/Entities/InputMessageContent/InputRichMessageContent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Longman\TelegramBot\Entities\InputMessageContent;

use Longman\TelegramBot\Entities\Entity;
use Longman\TelegramBot\Entities\RichBlock\RichBlock;

/**
* Class InputRichMessageContent
*
* @link https://core.telegram.org/bots/api#inputrichmessagecontent
*
* @method RichBlock[] getBlocks() Array of blocks forming the message
*/
class InputRichMessageContent extends Entity implements InputMessageContent
{
/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'blocks' => [RichBlock::class],
];
}
}
25 changes: 25 additions & 0 deletions src/Entities/InputRichMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Longman\TelegramBot\Entities;

use Longman\TelegramBot\Entities\RichBlock\RichBlock;

/**
* Class InputRichMessage
*
* @link https://core.telegram.org/bots/api#inputrichmessage
*
* @method RichBlock[] getBlocks() Array of blocks forming the message
*/
class InputRichMessage extends Entity
{
/**
* {@inheritdoc}
*/
protected function subEntities(): array
{
return [
'blocks' => [RichBlock::class],
];
}
}
12 changes: 0 additions & 12 deletions src/Entities/Link.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
<?php

/**
* This file is part of the TelegramBot package.
*
* (c) Avtandil Kikabidze aka LONGMAN <akalongman@gmail.com>
*
* 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
{

}
2 changes: 2 additions & 0 deletions src/Entities/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down
36 changes: 36 additions & 0 deletions src/Entities/RichBlock/RichBlock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

use Longman\TelegramBot\Entities\Entity;
use Longman\TelegramBot\Entities\Factory;

/**
* Class RichBlock
*
* This object represents a block in a rich formatted message.
* Currently, it can be one of the subclass types.
*
* @link https://core.telegram.org/bots/api#richblock
*/
class RichBlock extends Entity implements Factory
{
/**
* @param array $data
* @param string $bot_username
*
* @return RichBlock
*/
public static function make(array $data, string $bot_username): Entity
{
$type = $data['type'] ?? '';

$class = __NAMESPACE__ . '\\RichBlock' . str_replace(' ', '', ucwords(str_replace('_', ' ', $type)));
if (class_exists($class)) {
return new $class($data, $bot_username);
}

// Fallback to base entity if the specific class doesn't exist
return new self($data, $bot_username);
}
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockAnchor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockAnchor
*
* @link https://core.telegram.org/bots/api#richblockanchor
*/
class RichBlockAnchor extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockAnimation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockAnimation
*
* @link https://core.telegram.org/bots/api#richblockanimation
*/
class RichBlockAnimation extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockAudio.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockAudio
*
* @link https://core.telegram.org/bots/api#richblockaudio
*/
class RichBlockAudio extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockBlockQuotation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockBlockQuotation
*
* @link https://core.telegram.org/bots/api#richblockblockquotation
*/
class RichBlockBlockQuotation extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockCaption.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockCaption
*
* @link https://core.telegram.org/bots/api#richblockcaption
*/
class RichBlockCaption extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockCollage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockCollage
*
* @link https://core.telegram.org/bots/api#richblockcollage
*/
class RichBlockCollage extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockDetails.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockDetails
*
* @link https://core.telegram.org/bots/api#richblockdetails
*/
class RichBlockDetails extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockDivider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockDivider
*
* @link https://core.telegram.org/bots/api#richblockdivider
*/
class RichBlockDivider extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockFooter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockFooter
*
* @link https://core.telegram.org/bots/api#richblockfooter
*/
class RichBlockFooter extends RichBlock
{
}
12 changes: 12 additions & 0 deletions src/Entities/RichBlock/RichBlockList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Longman\TelegramBot\Entities\RichBlock;

/**
* Class RichBlockList
*
* @link https://core.telegram.org/bots/api#richblocklist
*/
class RichBlockList extends RichBlock
{
}
Loading