Skip to content

Commit

Permalink
Merge pull request #1418 from php-telegram-bot/bot-api-6.8
Browse files Browse the repository at this point in the history
Bot API 6.8
  • Loading branch information
noplanman committed Aug 29, 2023
2 parents b85a12c + 6ea1ae7 commit e804163
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 5 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Expand Up @@ -5,8 +5,9 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c

## [Unreleased]
### Notes
- [:ledger: View file changes][Unreleased]
- [:ledger: View file changes][Unreleased][:page_with_curl: DB migration script][unreleased-sql-migration]
### Added
- Bot API 6.8 (@noplanman)
### Changed
### Deprecated
### Removed
Expand Down Expand Up @@ -624,6 +625,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
### Deprecated
- Move `hideKeyboard` to `removeKeyboard`.

[unreleased-sql-migration]: https://github.com/php-telegram-bot/core/tree/develop/utils/db-schema-update/0.81.0-unreleased.sql
[0.81.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.80.0-0.81.0.sql
[0.80.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/master/utils/db-schema-update/0.79.0-0.80.0.sql
[0.80.0-bc-commands-with-underscores]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#commands-with-underscores
Expand Down
5 changes: 3 additions & 2 deletions src/DB.php
Expand Up @@ -1136,7 +1136,7 @@ public static function insertMessageRequest(Message $message): bool
`id`, `user_id`, `chat_id`, `message_thread_id`, `sender_chat_id`, `date`, `forward_from`, `forward_from_chat`, `forward_from_message_id`,
`forward_signature`, `forward_sender_name`, `forward_date`, `is_topic_message`,
`reply_to_chat`, `reply_to_message`, `via_bot`, `edit_date`, `media_group_id`, `author_signature`, `text`, `entities`, `caption_entities`,
`audio`, `document`, `animation`, `game`, `photo`, `sticker`, `video`, `voice`, `video_note`, `caption`, `has_media_spoiler`, `contact`,
`audio`, `document`, `animation`, `game`, `photo`, `sticker`, `story`, `video`, `voice`, `video_note`, `caption`, `has_media_spoiler`, `contact`,
`location`, `venue`, `poll`, `dice`, `new_chat_members`, `left_chat_member`,
`new_chat_title`, `new_chat_photo`, `delete_chat_photo`, `group_chat_created`,
`supergroup_chat_created`, `channel_chat_created`, `message_auto_delete_timer_changed`, `migrate_to_chat_id`, `migrate_from_chat_id`,
Expand All @@ -1147,7 +1147,7 @@ public static function insertMessageRequest(Message $message): bool
:message_id, :user_id, :chat_id, :message_thread_id, :sender_chat_id, :date, :forward_from, :forward_from_chat, :forward_from_message_id,
:forward_signature, :forward_sender_name, :forward_date, :is_topic_message,
:reply_to_chat, :reply_to_message, :via_bot, :edit_date, :media_group_id, :author_signature, :text, :entities, :caption_entities,
:audio, :document, :animation, :game, :photo, :sticker, :video, :voice, :video_note, :caption, :has_media_spoiler, :contact,
:audio, :document, :animation, :game, :photo, :sticker, :story, :video, :voice, :video_note, :caption, :has_media_spoiler, :contact,
:location, :venue, :poll, :dice, :new_chat_members, :left_chat_member,
:new_chat_title, :new_chat_photo, :delete_chat_photo, :group_chat_created,
:supergroup_chat_created, :channel_chat_created, :message_auto_delete_timer_changed, :migrate_to_chat_id, :migrate_from_chat_id,
Expand Down Expand Up @@ -1202,6 +1202,7 @@ public static function insertMessageRequest(Message $message): bool
$sth->bindValue(':game', $message->getGame());
$sth->bindValue(':photo', self::entitiesArrayToJson($message->getPhoto() ?: []));
$sth->bindValue(':sticker', $message->getSticker());
$sth->bindValue(':story', $message->getStory());
$sth->bindValue(':video', $message->getVideo());
$sth->bindValue(':voice', $message->getVoice());
$sth->bindValue(':video_note', $message->getVideoNote());
Expand Down
1 change: 1 addition & 0 deletions src/Entities/Chat.php
Expand Up @@ -28,6 +28,7 @@
* @method ChatPhoto getPhoto() Optional. Chat photo. Returned only in getChat.
* @method string[] getActiveUsernames() Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in getChat.
* @method string getEmojiStatusCustomEmojiId() Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat.
* @method int getEmojiStatusExpirationDate() Optional. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat.
* @method string getBio() Optional. Bio of the other party in a private chat. Returned only in getChat.
* @method bool getHasPrivateForwards() Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.
* @method bool getHasRestrictedVoiceAndVideoMessages() Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.
Expand Down
2 changes: 2 additions & 0 deletions src/Entities/Message.php
Expand Up @@ -57,6 +57,7 @@
* @method Game getGame() Optional. Message is a game, information about the game.
* @method PhotoSize[] getPhoto() Optional. Message is a photo, available sizes of the photo
* @method Sticker getSticker() Optional. Message is a sticker, information about the sticker
* @method Story getStory() Optional. Message is a forwarded story
* @method Video getVideo() Optional. Message is a video, information about the video
* @method Voice getVoice() Optional. Message is a voice message, information about the file
* @method VideoNote getVideoNote() Optional. Message is a video note message, information about the video
Expand Down Expand Up @@ -121,6 +122,7 @@ protected function subEntities(): array
'document' => Document::class,
'photo' => [PhotoSize::class],
'sticker' => Sticker::class,
'story' => Story::class,
'video' => Video::class,
'video_note' => VideoNote::class,
'voice' => Voice::class,
Expand Down
6 changes: 4 additions & 2 deletions src/Entities/PollAnswer.php
Expand Up @@ -19,7 +19,8 @@
* @link https://core.telegram.org/bots/api#pollanswer
*
* @method string getPollId() Unique poll identifier
* @method User getUser() The user, who changed the answer to the poll
* @method Chat getVoterChat() Optional. The chat that changed the answer to the poll, if the voter is anonymous
* @method User getUser() Optional. The user, who changed the answer to the poll
* @method array getOptionIds() 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.
*/
class PollAnswer extends Entity
Expand All @@ -30,7 +31,8 @@ class PollAnswer extends Entity
protected function subEntities(): array
{
return [
'user' => User::class,
'voter_chat' => Chat::class,
'user' => User::class,
];
}
}
22 changes: 22 additions & 0 deletions src/Entities/Story.php
@@ -0,0 +1,22 @@
<?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 Story
*
* @link https://core.telegram.org/bots/api#story
*/
class Story extends Entity
{

}
2 changes: 2 additions & 0 deletions src/Request.php
Expand Up @@ -94,6 +94,7 @@
* @method static ServerResponse reopenGeneralForumTopic(array $data) Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.
* @method static ServerResponse hideGeneralForumTopic(array $data) Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.
* @method static ServerResponse unhideGeneralForumTopic(array $data) Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
* @method static ServerResponse unpinAllGeneralForumTopicMessages(array $data) Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
* @method static ServerResponse answerCallbackQuery(array $data) Use this method to send answers to callback queries sent from inline keyboards. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
* @method static ServerResponse answerInlineQuery(array $data) Use this method to send answers to an inline query. On success, True is returned.
* @method static ServerResponse setMyCommands(array $data) Use this method to change the list of the bot's commands. Returns True on success.
Expand Down Expand Up @@ -269,6 +270,7 @@ class Request
'reopenGeneralForumTopic',
'hideGeneralForumTopic',
'unhideGeneralForumTopic',
'unpinAllGeneralForumTopicMessages',
'answerCallbackQuery',
'answerInlineQuery',
'setMyCommands',
Expand Down
1 change: 1 addition & 0 deletions structure.sql
Expand Up @@ -102,6 +102,7 @@ CREATE TABLE IF NOT EXISTS `message` (
`game` TEXT COMMENT 'Game object. Message is a game, information about the game',
`photo` TEXT COMMENT 'Array of PhotoSize objects. Message is a photo, available sizes of the photo',
`sticker` TEXT COMMENT 'Sticker object. Message is a sticker, information about the sticker',
`story` TEXT COMMENT 'Story object. Message is a forwarded story',
`video` TEXT COMMENT 'Video object. Message is a video, information about the video',
`voice` TEXT COMMENT 'Voice Object. Message is a Voice, information about the Voice',
`video_note` TEXT COMMENT 'VoiceNote Object. Message is a Video Note, information about the Video Note',
Expand Down
2 changes: 2 additions & 0 deletions utils/db-schema-update/0.81.0-unreleased.sql
@@ -0,0 +1,2 @@
ALTER TABLE `message`
ADD COLUMN `story` TEXT DEFAULT NULL COMMENT 'Story object. Message is a forwarded story' AFTER `sticker`;

0 comments on commit e804163

Please sign in to comment.