diff --git a/CHANGELOG.md b/CHANGELOG.md index 53a3cb4f..4ab38aa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,14 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ### Notes - [:ledger: View file changes][Unreleased] ### Added +- Bot API 6.2 (@OxMohsen) (#1350) ### Changed ### Deprecated ### Removed +- `VoiceChatX` entities, use `VideoChatX` entities instead. +- `all_members_are_administrators` property from `Message` entity. Database column still exists, but may be removed in the future. +- `Request::getChatMembersCount()`, use `Request::getChatMemberCount()` instead. +- `Request::kickChatMember()`, use `Request::banChatMember()` instead. ### Fixed ### Security diff --git a/README.md b/README.md index 9c382971..a2d50450 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ A Telegram Bot based on the official [Telegram Bot API] -[![API Version](https://img.shields.io/badge/Bot%20API-6.1%20%28June%202022%29-32a2da.svg)](https://core.telegram.org/bots/api#june-20-2022) +[![API Version](https://img.shields.io/badge/Bot%20API-6.2%20%28August%202022%29-32a2da.svg)](https://core.telegram.org/bots/api#june-20-2022) [![Join the bot support group on Telegram](https://img.shields.io/badge/telegram-@PHP__Telegram__Bot__Support-64659d.svg)](https://telegram.me/PHP_Telegram_Bot_Support) [![Donate](https://img.shields.io/badge/%F0%9F%92%99-Donate%20%2F%20Support%20Us-blue.svg)](#donate) -[![Build Status](https://travis-ci.com/php-telegram-bot/core.svg?branch=master)](https://travis-ci.com/github/php-telegram-bot/core) +[![Tests](https://github.com/php-telegram-bot/core/actions/workflows/tests.yaml/badge.svg)](https://github.com/php-telegram-bot/core/actions/workflows/tests.yaml) [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-telegram-bot/core/master.svg?style=flat)](https://scrutinizer-ci.com/g/php-telegram-bot/core/?b=master) [![Code Quality](https://img.shields.io/scrutinizer/g/php-telegram-bot/core/master.svg?style=flat)](https://scrutinizer-ci.com/g/php-telegram-bot/core/?b=master) [![Latest Stable Version](https://img.shields.io/packagist/v/longman/telegram-bot.svg)](https://packagist.org/packages/longman/telegram-bot) @@ -78,7 +78,7 @@ This Bot aims to provide a platform where one can simply write a bot and have in The Bot can: - Retrieve updates with [webhook](#webhook-installation) and [getUpdates](#getupdates-installation) methods. -- Supports all types and methods according to Telegram Bot API 6.1 (June 2022). +- Supports all types and methods according to Telegram Bot API 6.2 (August 2022). - Supports supergroups. - Handle commands in chat with other bots. - Manage Channel from the bot admin interface. @@ -389,15 +389,15 @@ The reason for denying an update can be defined with the `$reason` parameter. Th ### Types -All types are implemented according to Telegram API 6.1 (June 2022). +All types are implemented according to Telegram API 6.2 (August 2022). ### Inline Query -Full support for inline query according to Telegram API 6.1 (June 2022). +Full support for inline query according to Telegram API 6.2 (August 2022). ### Methods -All methods are implemented according to Telegram API 6.1 (June 2022). +All methods are implemented according to Telegram API 6.2 (August 2022). #### Send Message diff --git a/src/DB.php b/src/DB.php index 7ff97783..a9e72218 100644 --- a/src/DB.php +++ b/src/DB.php @@ -493,16 +493,15 @@ public static function insertChat(Chat $chat, ?string $date = null, ?int $migrat try { $sth = self::$pdo->prepare(' INSERT IGNORE INTO `' . TB_CHAT . '` - (`id`, `type`, `title`, `username`, `first_name`, `last_name`, `all_members_are_administrators`, `created_at` ,`updated_at`, `old_id`) + (`id`, `type`, `title`, `username`, `first_name`, `last_name`, `created_at` ,`updated_at`, `old_id`) VALUES - (:id, :type, :title, :username, :first_name, :last_name, :all_members_are_administrators, :created_at, :updated_at, :old_id) + (:id, :type, :title, :username, :first_name, :last_name, :created_at, :updated_at, :old_id) ON DUPLICATE KEY UPDATE `type` = VALUES(`type`), `title` = VALUES(`title`), `username` = VALUES(`username`), `first_name` = VALUES(`first_name`), `last_name` = VALUES(`last_name`), - `all_members_are_administrators` = VALUES(`all_members_are_administrators`), `updated_at` = VALUES(`updated_at`) '); @@ -524,7 +523,6 @@ public static function insertChat(Chat $chat, ?string $date = null, ?int $migrat $sth->bindValue(':username', $chat->getUsername()); $sth->bindValue(':first_name', $chat->getFirstName()); $sth->bindValue(':last_name', $chat->getLastName()); - $sth->bindValue(':all_members_are_administrators', $chat->getAllMembersAreAdministrators(), PDO::PARAM_INT); $date = $date ?: self::getTimestamp(); $sth->bindValue(':created_at', $date); $sth->bindValue(':updated_at', $date); diff --git a/src/Entities/Chat.php b/src/Entities/Chat.php index 60d3e229..c2456870 100644 --- a/src/Entities/Chat.php +++ b/src/Entities/Chat.php @@ -124,17 +124,4 @@ public function isChannel(): bool { return $this->getType() === 'channel'; } - - /** - * Optional. True if a group has 'All Members Are Admins' enabled. - * - * @deprecated - * @see Chat::getPermissions() - * - * @return bool|null - */ - public function getAllMembersAreAdministrators(): ?bool - { - return $this->getProperty('all_members_are_administrators'); - } } diff --git a/src/Entities/Message.php b/src/Entities/Message.php index b6fabff3..60a611a7 100644 --- a/src/Entities/Message.php +++ b/src/Entities/Message.php @@ -122,10 +122,6 @@ protected function subEntities(): array 'successful_payment' => SuccessfulPayment::class, 'passport_data' => PassportData::class, 'proximity_alert_triggered' => ProximityAlertTriggered::class, - 'voice_chat_scheduled' => VoiceChatScheduled::class, // deprecated - 'voice_chat_started' => VoiceChatStarted::class, // deprecated - 'voice_chat_ended' => VoiceChatEnded::class, // deprecated - 'voice_chat_participants_invited' => VoiceChatParticipantsInvited::class, // deprecated 'video_chat_scheduled' => VideoChatScheduled::class, 'video_chat_started' => VideoChatStarted::class, 'video_chat_ended' => VideoChatEnded::class, diff --git a/src/Entities/VoiceChatEnded.php b/src/Entities/VoiceChatEnded.php deleted file mode 100644 index edcd6ecd..00000000 --- a/src/Entities/VoiceChatEnded.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Longman\TelegramBot\Entities; - -/** - * Class VoiceChatEnded - * - * Represents a service message about new members invited to a voice chat - * - * @deprecated See VideoChatEnded instead - * - * @link https://core.telegram.org/bots/api#voicechatended - * - * @method int getDuration() Voice chat duration; in seconds - */ -class VoiceChatEnded extends Entity -{ - -} diff --git a/src/Entities/VoiceChatParticipantsInvited.php b/src/Entities/VoiceChatParticipantsInvited.php deleted file mode 100644 index a877214f..00000000 --- a/src/Entities/VoiceChatParticipantsInvited.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Longman\TelegramBot\Entities; - -/** - * Class VoiceChatParticipantsInvited - * - * Represents a service message about new members invited to a voice chat - * - * @deprecated See VideoChatParticipantsInvited instead - * - * @link https://core.telegram.org/bots/api#voicechatparticipantsinvited - * - * @method User[] getUsers() Optional. New members that were invited to the voice chat - */ -class VoiceChatParticipantsInvited extends Entity -{ - /** - * {@inheritdoc} - */ - protected function subEntities(): array - { - return [ - 'users' => [User::class], - ]; - } -} diff --git a/src/Entities/VoiceChatScheduled.php b/src/Entities/VoiceChatScheduled.php deleted file mode 100644 index 69c01174..00000000 --- a/src/Entities/VoiceChatScheduled.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Longman\TelegramBot\Entities; - -/** - * Class VoiceChatScheduled - * - * Represents a service message about a voice chat scheduled in the chat. - * - * @deprecated See VideoChatScheduled instead - * - * @link https://core.telegram.org/bots/api#voicechatscheduled - * - * @method int getStartDate() Point in time (Unix timestamp) when the voice chat is supposed to be started by a chat administrator - */ -class VoiceChatScheduled extends Entity -{ - -} diff --git a/src/Entities/VoiceChatStarted.php b/src/Entities/VoiceChatStarted.php deleted file mode 100644 index acd39277..00000000 --- a/src/Entities/VoiceChatStarted.php +++ /dev/null @@ -1,26 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Longman\TelegramBot\Entities; - -/** - * Class VoiceChatStarted - * - * Represents a service message about a voice chat started in the chat - * - * @deprecated See VideoChatStarted instead - * - * @link https://core.telegram.org/bots/api#voicechatstarted - */ -class VoiceChatStarted extends Entity -{ - -} diff --git a/src/Request.php b/src/Request.php index 75d78cc9..ed4144d5 100644 --- a/src/Request.php +++ b/src/Request.php @@ -959,19 +959,4 @@ public static function kickChatMember(array $data = []): ServerResponse { return static::banChatMember($data); } - - /** - * Use this method to get the number of members in a chat. Returns Int on success. - * - * @deprecated - * @see Request::getChatMemberCount() - * - * @param array $data - * - * @return ServerResponse - */ - public static function getChatMembersCount(array $data = []): ServerResponse - { - return static::getChatMemberCount($data); - } }