Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3ef80ed
المهام المنجزة:
google-labs-jules[bot] Jul 3, 2025
24b5af9
Merge pull request #1 from devrabie/remove-database-feature
devrabie Jul 3, 2025
4eaa598
تحديث معلومات المشروع في composer.json و README.md
google-labs-jules[bot] Jul 4, 2025
6472a6c
Merge pull request #2 from devrabie/remove-database-feature
devrabie Jul 4, 2025
676e452
feat: Implement Telegram Bot API 7.2 features
google-labs-jules[bot] Jul 4, 2025
145cf16
Merge pull request #3 from devrabie/telegram-api-7.2-update
devrabie Jul 4, 2025
d187d89
docs: Update version to 1.0.2 and add changelog entry for API 7.2
google-labs-jules[bot] Jul 4, 2025
6d51208
Merge pull request #4 from devrabie/telegram-api-7.2-update
devrabie Jul 4, 2025
370e196
Add support for Telegram Bot API 7.3
google-labs-jules[bot] Jul 4, 2025
fc28e3e
Merge pull request #5 from devrabie/feature/telegram-api-7.3-support
devrabie Jul 5, 2025
5aa3c6f
Refactor: Remove internal persistence and add Redis helper
google-labs-jules[bot] Jul 6, 2025
ecb9376
Refactor: Remove internal persistence, add Redis helper, and update R…
google-labs-jules[bot] Jul 6, 2025
bf149ac
Merge pull request #6 from devrabie/refactor/stateless-redis
devrabie Jul 6, 2025
324fac9
Add support for Telegram Bot API 7.4
google-labs-jules[bot] Jul 6, 2025
8d1960c
Merge pull request #7 from devrabie/feature/telegram-api-7.4-support
devrabie Jul 6, 2025
2f8bd03
feat: Replace Predis with native Redis and implement auto DI
google-labs-jules[bot] Jul 16, 2025
e54b460
I've made the following changes:
google-labs-jules[bot] Jul 16, 2025
fe86636
Merge pull request #8 from devrabie/feature/redis-di
devrabie Jul 16, 2025
c16cf33
I will update the PHPDocs for the bot name and description methods.
google-labs-jules[bot] Aug 5, 2025
07b6496
Merge pull request #9 from devrabie/feature/update-bot-settings-docs
devrabie Aug 14, 2025
5370734
Update Telegram.php
devrabie Aug 14, 2025
f036f7f
feat: Add password authentication for Redis connection
google-labs-jules[bot] Sep 22, 2025
6aa52b9
Merge pull request #10 from devrabie/feature/redis-password
devrabie Sep 22, 2025
3f81f14
feat: Add webhook secret token validation
google-labs-jules[bot] Nov 1, 2025
cb991b2
docs: Update version and add secret token documentation
google-labs-jules[bot] Nov 1, 2025
6205948
Merge pull request #11 from devrabie/feature-webhook-secret-token-val…
devrabie Nov 1, 2025
71313bc
feat: Add request timeout and Redis duplicate update prevention
google-labs-jules[bot] Dec 31, 2025
40125be
feat: Add request timeout and Redis duplicate update prevention
google-labs-jules[bot] Dec 31, 2025
b7f47de
Merge pull request #13 from devrabie/feature/timeout-and-redis-dedup-…
devrabie Dec 31, 2025
804bec6
Update Bot API to 9.3
google-labs-jules[bot] Dec 31, 2025
de4fe32
Merge pull request #14 from devrabie/bot-api-9.3-updates-134065994503…
devrabie Dec 31, 2025
b71852b
Update dependencies to latest stable versions for security
devrabie Mar 11, 2026
73107d1
Merge pull request #15 from devrabie/update-dependencies-security-fix…
devrabie Mar 11, 2026
5ac59ba
Update library to support Telegram Bot API 9.3
devrabie Mar 11, 2026
079ea96
Merge pull request #16 from devrabie/update-to-bot-api-9.3-1119371161…
devrabie Mar 11, 2026
191221b
Update library to support Bot API 9.4 and 9.5
devrabie Mar 13, 2026
c3082e6
Update library to support Bot API 9.4 and 9.5 (v1.2.0)
devrabie Mar 13, 2026
14ce895
Update library to support Telegram Bot API 9.4 and 9.5
devrabie Mar 13, 2026
22bb235
Update library to support Telegram Bot API 9.4 and 9.5
devrabie Mar 13, 2026
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
108 changes: 108 additions & 0 deletions API_9.3_FEATURES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# ميزات Telegram Bot API 9.3 وكيفية استخدامها

يقدم هذا الملف شرحاً للميزات الجديدة التي تم إضافتها في إصدار **Bot API 9.3** وكيفية الاستفادة منها عبر هذه المكتبة.

## 1. المواضيع في المحادثات الخاصة (Topics in Private Chats)

أصبح بإمكان البوتات الآن تفعيل نظام "المواضيع" (Topics) حتى في المحادثات الخاصة مع المستخدمين، مما يسمح بتنظيم المحادثة بشكل أفضل.

### التحقق من تفعيل الميزة
يمكنك معرفة ما إذا كان المستخدم قد فعل نظام المواضيع عبر حقل `has_topics_enabled` في كائن `User`:

```php
$user = $message->getFrom();
if ($user->getHasTopicsEnabled()) {
// نظام المواضيع مفعل في هذه المحادثة الخاصة
}
```

### إرسال رسالة إلى موضوع محدد
تدعم جميع طرق الإرسال (مثل `sendMessage`, `sendPhoto`, إلخ) بارامتر `message_thread_id` لإرسال الرسالة إلى موضوع معين داخل المحادثة الخاصة:

```php
Request::sendMessage([
'chat_id' => $user_id,
'text' => 'رسالة داخل موضوع خاص',
'message_thread_id' => $thread_id,
]);
```

---

## 2. بث مسودة الرسالة (sendMessageDraft)

تسمح هذه الطريقة الجديدة ببث أجزاء من الرسالة للمستخدم أثناء توليدها (مفيد جداً لبوتات الذكاء الاصطناعي).

**ملاحظة:** هذه الميزة مدعومة حالياً فقط للبوتات التي فعلت نظام المواضيع (Forum Topic Mode).

```php
Request::sendMessageDraft([
'chat_id' => $user_id,
'text' => 'جاري توليد الإجابة...',
]);
```

---

## 3. تحديثات الهدايا (Gifts)

تم إضافة ميزات قوية للتعامل مع الهدايا العادية والفريدة (Unique Gifts).

### الحصول على هدايا المستخدم أو الدردشة
تم إضافة طرق جديدة لجلب قائمة الهدايا:

```php
// هدايا المستخدم
$user_gifts = Request::getUserGifts(['user_id' => $user_id]);

// هدايا الدردشة (القنوات)
$chat_gifts = Request::getChatGifts(['chat_id' => $chat_id]);
```

### تحديثات الهدايا الفريدة (Unique Gift Info)
تم استبدال حقل `last_resale_star_count` بحقول أكثر تفصيلاً:
- `getLastResaleCurrency()`: العملة المستخدمة (مثل XTR أو TON).
- `getLastResaleAmount()`: المبلغ المدفوع.

---

## 4. إعادة نشر القصص (repostStory)

يمكن للبوتات الآن إعادة نشر القصص عبر حسابات الأعمال المختلفة التي تديرها.

```php
Request::repostStory([
'business_connection_id' => $connection_id,
'chat_id' => $target_chat_id,
'story_id' => $story_id,
]);
```

---

## 5. ميزات متنوعة

### تأثيرات الرسائل (Message Effects)
أصبح بإمكانك إضافة تأثيرات بصرية عند إعادة توجيه أو نسخ الرسائل باستخدام `message_effect_id`:

```php
Request::copyMessage([
'chat_id' => $target_chat_id,
'from_chat_id' => $source_chat_id,
'message_id' => $message_id,
'message_effect_id' => '5104841245755180586', // مثال لمعرف تأثير
]);
```

### تقييم المستخدم (User Rating)
يمكن الحصول على تقييم المستخدم بناءً على إنفاقه لنجوم تلجرام عبر `ChatFullInfo`:

```php
$chat_info = Request::getChat(['chat_id' => $user_id])->getResult();
$rating = $chat_info->getRating();
echo "مستوى المستخدم: " . $rating->getLevel();
```

---

للمزيد من التفاصيل حول كافة التغييرات، يرجى مراجعة [سجل تغييرات تلجرام الرسمي](https://core.telegram.org/bots/api-changelog#december-31-2025).
133 changes: 133 additions & 0 deletions API_9.4_9.5_FEATURES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# ميزات تحديث Bot API 9.4 و 9.5

يدعم هذا الإصدار من المكتبة ميزات تحديث Telegram Bot API 9.4 و 9.5. فيما يلي الميزات الجديدة وكيفية استخدامها.

## Bot API 9.5

### 1. الكيان الجديد `date_time` في الرسائل
تم إضافة نوع جديد للكيانات `MessageEntity` يسمى `date_time` لعرض التاريخ والوقت بتنسيق محدد للمستخدم.

```php
// مثال على تنسيق التاريخ والوقت في MarkdownV2
$text = "موعد الاجتماع: ![22:45 tomorrow](tg://time?unix=1740861900&format=wDT)";

Request::sendMessage([
'chat_id' => $chat_id,
'text' => $text,
'parse_mode' => 'MarkdownV2',
]);
```

### 2. ميزة بث الرسائل الجاري إنشاؤها (`sendMessageDraft`)
أصبح بإمكان جميع البوتات الآن استخدام الطريقة `sendMessageDraft` لبث أجزاء من الرسالة للمستخدم أثناء إنشائها (مثل تطبيقات الذكاء الاصطناعي).

```php
Request::sendMessageDraft([
'chat_id' => $chat_id,
'draft_id' => 12345, // معرف فريد للمسودة
'text' => "جاري التفكير...",
]);

// تحديث النص (سيظهر بحركة أنيميشن)
Request::sendMessageDraft([
'chat_id' => $chat_id,
'draft_id' => 12345,
'text' => "جاري التفكير... لقد وجدت الحل!",
]);

// إرسال الرسالة النهائية باستخدام sendMessage العادي
```

### 3. وسوم الأعضاء (Member Tags) وأذونات جديدة
تم إضافة حقل `tag` للأعضاء العاديين، وطريقة `setChatMemberTag` لتعيينها، بالإضافة إلى أذونات التحكم بها.

```php
// تعيين وسم لعضو
Request::setChatMemberTag([
'chat_id' => $chat_id,
'user_id' => $user_id,
'tag' => "مميز",
]);
```

الأذونات الجديدة:
- `can_edit_tag`: يسمح للمستخدم بتعديل وسمه الخاص.
- `can_manage_tags`: يسمح للمشرفين بتعديل وسوم الأعضاء.

---

## Bot API 9.4

### 1. المواضيع (Topics) في الدردشات الخاصة
أصبح بإمكان البوتات إنشاء مواضيع في الدردشات الخاصة مع المستخدمين، تماماً كما في المجموعات الكبيرة.

```php
// إنشاء موضوع في دردشة خاصة
Request::createForumTopic([
'chat_id' => $user_id,
'name' => "الدعم الفني",
]);
```

### 2. أزرار ملونة ورموز تعبيرية مخصصة
يمكن الآن تغيير لون الأزرار وإضافة رموز تعبيرية مخصصة لها.

```php
$keyboard = new InlineKeyboard([
['text' => 'حذف', 'callback_data' => 'delete', 'style' => 'danger'], // زر أحمر
['text' => 'تأكيد', 'callback_data' => 'ok', 'style' => 'success'], // زر أخضر
['text' => 'معلومات', 'callback_data' => 'info', 'style' => 'primary'], // زر أزرق
]);

$keyboard_with_emoji = new Keyboard([
['text' => 'الإعدادات', 'icon_custom_emoji_id' => '5368324170671202286'],
]);
```

### 3. إدارة صورة الملف الشخصي للبوت
طرق جديدة لتعيين أو حذف صورة البوت الشخصية مباشرة عبر API.

```php
Request::setMyProfilePhoto([
'photo' => '/path/to/photo.jpg',
]);

Request::removeMyProfilePhoto();
```

### 4. جودة الفيديو ووسائط الملف الشخصي
- `VideoQuality`: الحصول على معلومات حول الجودات المتاحة للفيديو.
- `first_profile_audio`: الحصول على أول ملف صوتي في ملف تعريف المستخدم (للحسابات المميزة).
- `getUserProfileAudios`: جلب قائمة الملفات الصوتية في ملف تعريف المستخدم.

```php
$response = Request::getUserProfileAudios(['user_id' => $user_id]);
if ($response->isOk()) {
$audios = $response->getResult()->getAudios();
}
```

- `first_profile_audio`: في كائن `ChatFullInfo` (للدردشات الخاصة)، يمثل أول ملف صوتي في ملف تعريف المستخدم.

```php
// جلب أول صوت في الملف الشخصي من معلومات الدردشة الكاملة
$chat_info = Request::getChat(['chat_id' => $user_id])->getResult();
$first_audio = $chat_info->getFirstProfileAudio();
```

### 5. زر الدردشة السفلي (Chat Bottom Button)
تم إضافة دعم لتعيين زر في أسفل الدردشة يفتح تطبيق ويب (Mini App).

```php
Request::setChatBottomButton([
'chat_id' => $chat_id,
'bottom_button' => [
'text' => 'فتح المتجر',
'web_app' => ['url' => 'https://example.com/shop'],
],
]);
```

### 6. ميزات الهدايا (Gifts)
- إضافة حقل `rarity` لنماذج الهدايا الفريدة (`UniqueGiftModel`).
- إضافة حقل `is_burned` للهدايا الفريدة (`UniqueGift`) التي تم استخدامها في نظام الصياغة (Crafting).
82 changes: 81 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,85 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
## [Unreleased]
### Notes
- [:ledger: View file changes][Unreleased]

## [1.2.0] - 2026-03-01
### Notes
- [:ledger: View file changes][1.2.0]
- [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
- **Bot API 9.5:**
- New `MessageEntity` type `date_time` with `unix_time` and `date_time_format`.
- Support for `sendMessageDraft` for all bots.
- Member tags support in `ChatMemberMember`, `ChatMemberRestricted`, and `setChatMemberTag`.
- New permissions `can_edit_tag` and `can_manage_tags`.
- **Bot API 9.4:**
- Topics in private chats via `createForumTopic`.
- Colored and custom emoji buttons (`KeyboardButton` and `InlineKeyboardButton`).
- Bot profile photo management (`setMyProfilePhoto`, `removeMyProfilePhoto`).
- Enhanced video and audio metadata (`VideoQuality`, `UserProfileAudios`, `first_profile_audio`).
- **Private Chat Topics:** Support for forum topics in private chats.
- **Message Streaming:** Added `sendMessageDraft` for streaming partial messages.
- **Gifts Enhancement:** Added `getUserGifts`, `getChatGifts`, and support for Unique Gifts with colors and blockchain info.
- **Business Accounts:** Complete support for managed business accounts, including story reposting, checklist management, and profile settings.
- **Telegram Stars:** Full support for Star transactions, subscriptions, and affiliate programs.
- **Channel Direct Messages:** Support for direct messages in channels and suggested posts.
- **New Entities:** `VideoQuality`, `UserRating`, `AffiliateInfo`, `StarTransaction`, `PaidMediaPurchased`, `PreparedInlineMessage`, `WebAppUser`, `ChatOwnerLeft`, `ChatOwnerChanged`, `UserProfileAudios`.
- **New Request Methods:** `repostStory`, `verifyUser`, `verifyChat`, `removeUserVerification`, `removeChatVerification`, `createChatSubscriptionInviteLink`, `editChatSubscriptionInviteLink`, `editUserStarSubscription`, `refundStarPayment`, `savePreparedInlineMessage`.
### Changed
- Updated `User`, `Message`, `Chat`, `ChatFullInfo`, `Poll`, `InlineKeyboardButton`, `KeyboardButton`, and many other entities with new fields.
- Replaced `last_resale_star_count` with `last_resale_currency` and `last_resale_amount` in `UniqueGiftInfo`.
### Deprecated
### Removed
- Deprecated `hide_url` from `InlineQueryResultArticle`.
- Replaced fields in `UniqueGiftInfo` as per API 9.3.
### Fixed
### Security

## [1.0.3] - 2024-05-07
### Notes
- [:ledger: View file changes][1.0.3]
- Support for Telegram Bot API 7.3.
### Added
- **Poll Enhancements:**
- New entity `InputPollOption` (`src/Entities/Poll/InputPollOption.php`) with properties `text` and optional `text_entities`.
- Added optional property `question_entities` (array of `MessageEntity`) to `src/Entities/Poll.php`.
- Added optional property `text_entities` (array of `MessageEntity`) to `src/Entities/PollOption.php`.
- Updated `sendPoll` method in `src/Request.php`:
- Changed `options` parameter to be an array of `InputPollOption`.
- Added optional parameters `question_parse_mode` (string) and `question_entities` (array of `MessageEntity`).
- **Chat and getChat Method Refactoring:**
- New entity `ChatFullInfo` (`src/Entities/ChatFullInfo.php`) containing all properties from `Chat` entity plus properties from `getChat` (e.g., `description`, `invite_link`, `pinned_message`, `bio`) and new optional property `max_reaction_count` (integer).
- Updated `getChat` method in `src/Request.php` docblock to return a `ServerResponse` with a `ChatFullInfo` object.
- **Miscellaneous Updates:**
- New Chat Background entities:
- `src/Entities/ChatBackground.php`
- `src/Entities/Background/BackgroundType.php`
- `src/Entities/Background/BackgroundFill.php`
- Added optional property `chat_background_set` (`ChatBackground`) to `src/Entities/Message.php`.
- Added optional property `via_join_request` (boolean) to `src/Entities/ChatMemberUpdated.php`.
- Added optional parameter `live_period` (integer) to `editMessageLiveLocation` method in `src/Request.php`.
### Changed
- Version bumped to 1.0.3.
### Deprecated
### Removed
### Fixed
### Security

## [1.0.2] - 2025-07-04
### Notes
- [:ledger: View file changes][1.0.2]
- Support for Telegram Bot API 7.2.
### Added
- Bot API 7.2 support. This includes:
- Business Account Integration (New entities: `BusinessConnection`, `BusinessMessagesDeleted`; Updated `Update.php`, `Request.php`, `Message.php`)
- Business Information Entities (New entities: `BusinessIntro`, `BusinessLocation`, `BusinessOpeningHours`, `BusinessOpeningHoursInterval`; Updated `Chat.php`)
- Sticker Pack Modifications (Updated `StickerSet.php`, `InputSticker.php`, `Request.php`)
- Request & Shared Object Improvements (New entity: `SharedUser`; Updated `KeyboardButtonRequestUsers.php`, `KeyboardButtonRequestChat.php`, `UsersShared.php`, `ChatShared.php`)
- Miscellaneous Changes (New entity: `Birthdate`; Updated `Chat.php`, `Message.php`, `User.php`)
### Changed
- Version bumped to 1.0.2.
### Deprecated
### Removed
### Fixed
Expand Down Expand Up @@ -694,7 +771,10 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
[PSR-3]: https://www.php-fig.org/psr/psr-3
[Tidelift]: https://tidelift.com/subscription/pkg/packagist-longman-telegram-bot?utm_source=packagist-longman-telegram-bot&utm_medium=referral&utm_campaign=changelog

[Unreleased]: https://github.com/php-telegram-bot/core/compare/master...develop
[Unreleased]: https://github.com/php-telegram-bot/core/compare/1.2.0...develop
[1.2.0]: https://github.com/php-telegram-bot/core/compare/1.0.3...1.2.0
[1.0.3]: https://github.com/php-telegram-bot/core/compare/1.0.2...1.0.3
[1.0.2]: https://github.com/php-telegram-bot/core/compare/0.83.0...1.0.2
[0.83.0]: https://github.com/php-telegram-bot/core/compare/0.82.0...0.83.0
[0.82.0]: https://github.com/php-telegram-bot/core/compare/0.81.0...0.82.0
[0.81.0]: https://github.com/php-telegram-bot/core/compare/0.80.0...0.81.0
Expand Down
Loading