diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff35c6f95..2febaaafd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
Exclamation symbols (:exclamation:) note something of importance e.g. breaking changes. Click them to learn more.
## [Unreleased]
+:exclamation: After updating to this version, you will need to execute the [SQL migration script][unreleased-sql-migration] on your database.
### Added
+- Implemented new changes for Bot API 3.6 (streamable InputMediaVideo, connected website).
- `Telegram::getLastUpdateId()` method, returns ID of the last update that was processed.
- `Telegram::useGetUpdatesWithoutDatabase()` method, enables `Telegram::handleGetUpdates()` to run without a database.
### Changed
@@ -195,6 +197,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.52.0-unreleased.sql
[0.51.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/develop/utils/db-schema-update/0.50.0-0.51.0.sql
[0.50.0-bc-messagegetcommand-return-value]: https://github.com/php-telegram-bot/core/wiki/Breaking-backwards-compatibility#messagegetcommand-return-value
[0.48.0-sql-migration]: https://github.com/php-telegram-bot/core/tree/develop/utils/db-schema-update/0.47.1-0.48.0.sql
diff --git a/README.md b/README.md
index 76b063c1a..6cdaa6ca5 100644
--- a/README.md
+++ b/README.md
@@ -186,7 +186,7 @@ The bot can handle updates with **Webhook** or **getUpdates** method:
| ---- | :----: | :----: |
| Description | Telegram sends the updates directly to your host | You have to fetch Telegram updates manually |
| Host with https | Required | Not required |
-| MySQL | Not required | Required |
+| MySQL | Not required | ([Not](#getupdates-without-database)) Required |
## Webhook installation
@@ -257,9 +257,9 @@ $result = $telegram->setWebhook($hook_url, ['certificate' => '/path/to/certifica
Edit [*unset.php*][unset.php] with your bot credentials and execute it.
-### getUpdates installation
+## getUpdates installation
-The MySQL database must be enabled for the getUpdates method!
+For best performance, the MySQL database should be enabled for the `getUpdates` method!
Create [*getUpdatesCLI.php*][getUpdatesCLI.php] with the following contents:
```php
@@ -301,6 +301,13 @@ Lastly, run it!
$ ./getUpdatesCLI.php
```
+### getUpdates without database
+
+If you choose to / or are obliged to use the `getUpdates` method without a database, you can replace the `$telegram->useMySQL(...);` line above with:
+```php
+$telegram->useGetUpdatesWithoutDatabase();
+```
+
## Support
### Types
diff --git a/composer.json b/composer.json
index 3c51dfceb..01cf240b4 100644
--- a/composer.json
+++ b/composer.json
@@ -41,13 +41,13 @@
},
"scripts": {
"check-code": [
- "./vendor/bin/phpcs --standard=phpcs.xml -snp --encoding=utf-8 src/ tests/ --report-width=150"
+ "\"vendor/bin/phpcs\" --standard=phpcs.xml -snp --encoding=utf-8 src/ tests/ --report-width=150"
],
"test": [
- "./vendor/bin/phpunit"
+ "\"vendor/bin/phpunit\""
],
"test-cov": [
- "./vendor/bin/phpunit --coverage-clover build/logs/clover.xml"
+ "\"vendor/bin/phpunit\" --coverage-clover build/logs/clover.xml"
],
"test-cov-upload": [
"wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml"
diff --git a/src/DB.php b/src/DB.php
index bd3430bbd..ebf2a2ead 100644
--- a/src/DB.php
+++ b/src/DB.php
@@ -829,7 +829,7 @@ public static function insertMessageRequest(Message $message)
`location`, `venue`, `new_chat_members`, `left_chat_member`,
`new_chat_title`,`new_chat_photo`, `delete_chat_photo`, `group_chat_created`,
`supergroup_chat_created`, `channel_chat_created`,
- `migrate_from_chat_id`, `migrate_to_chat_id`, `pinned_message`
+ `migrate_from_chat_id`, `migrate_to_chat_id`, `pinned_message`, `connected_website`
) VALUES (
:message_id, :user_id, :chat_id, :date, :forward_from, :forward_from_chat, :forward_from_message_id,
:forward_date, :reply_to_chat, :reply_to_message, :media_group_id, :text, :entities, :audio, :document,
@@ -837,7 +837,7 @@ public static function insertMessageRequest(Message $message)
:location, :venue, :new_chat_members, :left_chat_member,
:new_chat_title, :new_chat_photo, :delete_chat_photo, :group_chat_created,
:supergroup_chat_created, :channel_chat_created,
- :migrate_from_chat_id, :migrate_to_chat_id, :pinned_message
+ :migrate_from_chat_id, :migrate_to_chat_id, :pinned_message, :connected_website
)
');
@@ -897,6 +897,7 @@ public static function insertMessageRequest(Message $message)
$sth->bindValue(':migrate_from_chat_id', $message->getMigrateFromChatId());
$sth->bindValue(':migrate_to_chat_id', $message->getMigrateToChatId());
$sth->bindValue(':pinned_message', $message->getPinnedMessage());
+ $sth->bindValue(':connected_website', $message->getConnectedWebsite());
return $sth->execute();
} catch (PDOException $e) {
diff --git a/src/Entities/InputMedia/InputMediaVideo.php b/src/Entities/InputMedia/InputMediaVideo.php
index ed9f6d007..5ab1345e2 100644
--- a/src/Entities/InputMedia/InputMediaVideo.php
+++ b/src/Entities/InputMedia/InputMediaVideo.php
@@ -19,26 +19,29 @@
*
*
* $data = [
- * 'media' => '123abc',
- * 'caption' => 'Video caption',
- * 'width' => 800,
- * 'heidht' => 600,
- * 'duration' => 42
+ * 'media' => '123abc',
+ * 'caption' => 'Video caption (streamable)',
+ * 'width' => 800,
+ * 'height' => 600,
+ * 'duration' => 42,
+ * 'supports_streaming' => true
* ];
*
*
- * @method string getType() Type of the result, must be video
- * @method string getMedia() File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name.
- * @method string getCaption() Optional. Caption of the video to be sent, 0-200 characters
- * @method int getWidth() Optional. Video width
- * @method int getHeight() Optional. Video height
- * @method int getDuration() Optional. Video duration
+ * @method string getType() Type of the result, must be video
+ * @method string getMedia() File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name.
+ * @method string getCaption() Optional. Caption of the video to be sent, 0-200 characters
+ * @method int getWidth() Optional. Video width
+ * @method int getHeight() Optional. Video height
+ * @method int getDuration() Optional. Video duration
+ * @method bool getSupportsStreaming() Optional. Pass True, if the uploaded video is suitable for streaming
*
- * @method $this setMedia(string $media) File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name.
- * @method $this setCaption(string $caption) Optional. Caption of the video to be sent, 0-200 characters
- * @method $this setWidth(int $width) Optional. Video width
- * @method $this setHeight(int $height) Optional. Video height
- * @method $this setDuration(int $duration) Optional. Video duration
+ * @method $this setMedia(string $media) File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://" to upload a new one using multipart/form-data under name.
+ * @method $this setCaption(string $caption) Optional. Caption of the video to be sent, 0-200 characters
+ * @method $this setWidth(int $width) Optional. Video width
+ * @method $this setHeight(int $height) Optional. Video height
+ * @method $this setDuration(int $duration) Optional. Video duration
+ * @method $this setSupportsStreaming(bool $supports_streaming) Optional. Pass True, if the uploaded video is suitable for streaming
*/
class InputMediaVideo extends Entity implements InputMedia
{
diff --git a/src/Entities/Message.php b/src/Entities/Message.php
index 3fc1da1b7..0e592dc68 100644
--- a/src/Entities/Message.php
+++ b/src/Entities/Message.php
@@ -52,6 +52,7 @@
* @method Message getPinnedMessage() Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
* @method Invoice getInvoice() Optional. Message is an invoice for a payment, information about the invoice.
* @method SuccessfulPayment getSuccessfulPayment() Optional. Message is a service message about a successful payment, information about the payment.
+ * @method string getConnectedWebsite() Optional. The domain name of the website on which the user has logged in.
*/
class Message extends Entity
{
diff --git a/structure.sql b/structure.sql
index 33e05f0c3..f63d43616 100644
--- a/structure.sql
+++ b/structure.sql
@@ -101,6 +101,7 @@ CREATE TABLE IF NOT EXISTS `message` (
`migrate_to_chat_id` bigint NULL DEFAULT NULL COMMENT 'Migrate to chat identifier. The group has been migrated to a supergroup with the specified identifier',
`migrate_from_chat_id` bigint NULL DEFAULT NULL COMMENT 'Migrate from chat identifier. The supergroup has been migrated from a group with the specified identifier',
`pinned_message` TEXT NULL COMMENT 'Message object. Specified message was pinned',
+ `connected_website` TEXT NULL COMMENT 'The domain name of the website on which the user has logged in.',
PRIMARY KEY (`chat_id`, `id`),
KEY `user_id` (`user_id`),
diff --git a/utils/db-schema-update/0.52.0-unreleased.sql b/utils/db-schema-update/0.52.0-unreleased.sql
new file mode 100644
index 000000000..4b95fafac
--- /dev/null
+++ b/utils/db-schema-update/0.52.0-unreleased.sql
@@ -0,0 +1 @@
+ALTER TABLE `message` ADD COLUMN `connected_website` TEXT NULL COMMENT 'The domain name of the website on which the user has logged in.' AFTER `pinned_message`;