diff --git a/CHANGELOG.md b/CHANGELOG.md index bee3f0f20..159cbb205 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,7 +86,7 @@ Finally, all new bots and plugins will be automatically analyzed by MadelineProt Other features: - Thanks to the many translation contributors @ https://weblate.madelineproto.xyz/, MadelineProto is now localized in Hebrew, Persian, Kurdish, Uzbek, Russian, French and Italian! -- Added simplified `sendMessage`, `sendDocument`, `sendPhoto` methods that return abstract [Message](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Message.html) objects with simplified properties and bound methods! +- Added simplified [sendMessage](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#sendmessage-int-string-peer-string-message-html-markdown-null-parsemode-null-int-null-replytomsgid-null-int-null-topmsgid-null-array-null-replymarkup-null-int-null-sendas-null-int-null-scheduledate-null-bool-silent-false-bool-noforwards-false-bool-background-false-bool-cleardraft-false-bool-nowebpage-false-bool-updatestickersetsorder-false-danog-madelineproto-eventhandler-message), [sendDocument](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#senddocument-int-string-peer-message-media-danog-madelineproto-localfile-danog-madelineproto-remoteurl-danog-madelineproto-botapifileid-readablestream-file-message-media-danog-madelineproto-localfile-danog-madelineproto-remoteurl-danog-madelineproto-botapifileid-readablestream-null-thumb-null-string-caption-html-markdown-null-parsemode-null-callable-callback-null-string-filename-null-string-mimetype-null-int-ttl-null-bool-spoiler-false-int-null-replytomsgid-null-int-null-topmsgid-null-array-null-replymarkup-null-int-null-sendas-null-int-null-scheduledate-null-bool-silent-false-bool-noforwards-false-bool-background-false-bool-cleardraft-false-bool-updatestickersetsorder-false-danog-madelineproto-eventhandler-message), [sendPhoto](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#sendphoto-int-string-peer-message-media-danog-madelineproto-localfile-danog-madelineproto-remoteurl-danog-madelineproto-botapifileid-readablestream-file-string-caption-html-markdown-null-parsemode-null-callable-callback-null-string-filename-null-int-ttl-null-bool-spoiler-false-int-null-replytomsgid-null-int-null-topmsgid-null-array-null-replymarkup-null-int-null-sendas-null-int-null-scheduledate-null-bool-silent-false-bool-noforwards-false-bool-background-false-bool-cleardraft-false-bool-updatestickersetsorder-false-danog-madelineproto-eventhandler-message) methods that return abstract [Message](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Message.html) objects with simplified properties and bound methods! - You can now use `Tools::callFork` to fork a new green thread! - You can now automatically pin messages broadcasted using `broadcastMessages`, `broadcastForwardMessages` by using the new `pin: true` parameter! - You can now use `sendMessageToAdmins` to send messages to the bot's admin (the peers returned by `getReportPeers`). diff --git a/docs b/docs index 64bf195ee..833b04cc9 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 64bf195ee68d92bde6f49955ef735f58e9d6083c +Subproject commit 833b04cc94d9ea46adbe41b0985617f1d132d9c3 diff --git a/examples/bot.php b/examples/bot.php index dd3071ee0..f723a6a92 100755 --- a/examples/bot.php +++ b/examples/bot.php @@ -30,7 +30,9 @@ use danog\MadelineProto\EventHandler\Filter\FilterText; use danog\MadelineProto\EventHandler\Message; use danog\MadelineProto\EventHandler\SimpleFilter\FromAdmin; use danog\MadelineProto\EventHandler\SimpleFilter\Incoming; +use danog\MadelineProto\LocalFile; use danog\MadelineProto\Logger; +use danog\MadelineProto\RemoteUrl; use danog\MadelineProto\Settings; use danog\MadelineProto\Settings\Database\Mysql; use danog\MadelineProto\Settings\Database\Postgres; @@ -59,7 +61,7 @@ class MyEventHandler extends SimpleEventHandler /** * @var int|string Username or ID of bot admin */ - const ADMIN = "@danogentili"; // !!! Change this to your username !!! + const ADMIN = "@me"; // !!! Change this to your username !!! /** * @var array diff --git a/src/EventHandler/Media/Photo.php b/src/EventHandler/Media/Photo.php index 15abf430f..f37a32f6e 100644 --- a/src/EventHandler/Media/Photo.php +++ b/src/EventHandler/Media/Photo.php @@ -21,13 +21,6 @@ final class Photo extends Media bool $protected, ) { parent::__construct($API, $rawMedia, $protected); - $hasStickers = false; - foreach ($rawMedia['document']['attributes'] as ['_' => $t]) { - if ($t === 'documentAttributeHasStickers') { - $hasStickers = true; - break; - } - } - $this->hasStickers = $hasStickers; + $this->hasStickers = $rawMedia['photo']['has_stickers']; } } diff --git a/src/MTProtoTools/FilesAbstraction.php b/src/MTProtoTools/FilesAbstraction.php index 807e11005..c241986e3 100644 --- a/src/MTProtoTools/FilesAbstraction.php +++ b/src/MTProtoTools/FilesAbstraction.php @@ -325,9 +325,9 @@ trait FilesAbstraction $params['media'] = $base; - return $this->methodCallAsyncRead( + return $this->wrapMessage($this->extractMessage($this->methodCallAsyncRead( 'messages.sendMedia', $params - ); + ))); } }