From 016528faa9078d9a85867254d3bfe14a72d9f798 Mon Sep 17 00:00:00 2001 From: Piagrammist Date: Fri, 27 Sep 2024 20:13:10 +0330 Subject: [PATCH 1/4] Fix: `ChannelParticipant::newParticipant` default value must be set to `Left` --- src/EventHandler/Channel/ChannelParticipant.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EventHandler/Channel/ChannelParticipant.php b/src/EventHandler/Channel/ChannelParticipant.php index ed18c18fa..9de86cade 100644 --- a/src/EventHandler/Channel/ChannelParticipant.php +++ b/src/EventHandler/Channel/ChannelParticipant.php @@ -19,7 +19,6 @@ namespace danog\MadelineProto\EventHandler\Channel; use danog\MadelineProto\EventHandler\ChatInvite; use danog\MadelineProto\EventHandler\Participant; use danog\MadelineProto\EventHandler\Participant\Left; -use danog\MadelineProto\EventHandler\Participant\Member; use danog\MadelineProto\EventHandler\Update; use danog\MadelineProto\MTProto; @@ -70,6 +69,6 @@ final class ChannelParticipant extends Update // if null, user joind $this->newParticipant = isset($rawChannelParticipant['new_participant']) ? Participant::fromRawParticipant($rawChannelParticipant['new_participant']) - : new Member(['user_id' => $this->userId, 'date' => $this->date]); + : new Left(['peer' => $this->userId]); } } From 0305abeee2e66d4e30286994cce17dcbbe8d39b5 Mon Sep 17 00:00:00 2001 From: Piagrammist Date: Fri, 27 Sep 2024 20:16:31 +0330 Subject: [PATCH 2/4] Improve comments wording --- src/EventHandler/Channel/ChannelParticipant.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EventHandler/Channel/ChannelParticipant.php b/src/EventHandler/Channel/ChannelParticipant.php index 9de86cade..b1dca66e9 100644 --- a/src/EventHandler/Channel/ChannelParticipant.php +++ b/src/EventHandler/Channel/ChannelParticipant.php @@ -11,7 +11,7 @@ * @author Amir Hossein Jafari * @copyright 2016-2023 Amir Hossein Jafari * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 - * @link https://docs.madelineproto.xyz MadelineProto documentation + * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\EventHandler\Channel; @@ -23,7 +23,7 @@ use danog\MadelineProto\EventHandler\Update; use danog\MadelineProto\MTProto; /** - * A participant has left, joined, was banned or admined in a [channel or supergroup](https://core.telegram.org/api/channel). + * A participant has left, joined, was banned or admin'd in a [channel or supergroup](https://core.telegram.org/api/channel). */ final class ChannelParticipant extends Update { @@ -62,11 +62,11 @@ final class ChannelParticipant extends Update $this->inviteLink = isset($rawChannelParticipant['invite']) ? ChatInvite::fromRawChatInvite($rawChannelParticipant['invite']) : null; - // If null, user lefted channel + // If null, user wasn't a participant. $this->prevParticipant = isset($rawChannelParticipant['prev_participant']) ? Participant::fromRawParticipant($rawChannelParticipant['prev_participant']) : new Left(['peer' => $this->userId]); - // if null, user joind + // If null, user has left. $this->newParticipant = isset($rawChannelParticipant['new_participant']) ? Participant::fromRawParticipant($rawChannelParticipant['new_participant']) : new Left(['peer' => $this->userId]); From bcc493b7a5e5454f1aaadd6da4144e40ff487913 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 19 Oct 2024 15:03:50 +0000 Subject: [PATCH 3/4] Peer database bugfix --- src/MTProtoTools/PeerDatabase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MTProtoTools/PeerDatabase.php b/src/MTProtoTools/PeerDatabase.php index 2c6d61850..80fc167be 100644 --- a/src/MTProtoTools/PeerDatabase.php +++ b/src/MTProtoTools/PeerDatabase.php @@ -265,7 +265,7 @@ final class PeerDatabase implements TLCallback if (!$this->API->settings->getDb()->getEnableUsernameDb()) { return; } - $new = self::getUsernames($new); + $new = $new ? self::getUsernames($new) : []; $old = $old ? self::getUsernames($old) : []; $diffToRemove = array_diff($old, $new); $diffToAdd = array_diff($new, $old); From 77211064e996d2c2235172e9656a29631d610016 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 19 Oct 2024 15:09:41 +0000 Subject: [PATCH 4/4] Bump to 8.3.4 --- README.md | 2 +- docs | 2 +- psalm-baseline.xml | 2 +- src/API.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index aa9b33c98..8c2804be9 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ Some of MadelineProto's core components are also available as separate, standalo * [danog\MadelineProto\EventHandler\AbstractStory »](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/AbstractStory.html) - Represents a Telegram Story. * [danog\MadelineProto\EventHandler\BotCommands »](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/BotCommands.html) - The [command set](https://core.telegram.org/api/bots/commands) of a certain bot in a certain chat has changed. * [danog\MadelineProto\EventHandler\CallbackQuery »](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/CallbackQuery.html) - Represents a query sent by the user by clicking on a button. - * [danog\MadelineProto\EventHandler\Channel\ChannelParticipant »](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Channel/ChannelParticipant.html) - A participant has left, joined, was banned or admined in a [channel or supergroup](https://core.telegram.org/api/channel). + * [danog\MadelineProto\EventHandler\Channel\ChannelParticipant »](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Channel/ChannelParticipant.html) - A participant has left, joined, was banned or admin'd in a [channel or supergroup](https://core.telegram.org/api/channel). * [danog\MadelineProto\EventHandler\Channel\MessageForwards »](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Channel/MessageForwards.html) - Indicates that the forward counter of a message in a channel has changed. * [danog\MadelineProto\EventHandler\Channel\MessageViewsChanged »](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Channel/MessageViewsChanged.html) - Indicates that the view counter of a message in a channel has changed. * [danog\MadelineProto\EventHandler\Channel\UpdateChannel »](https://docs.madelineproto.xyz/PHP/danog/MadelineProto/EventHandler/Channel/UpdateChannel.html) - A new channel is available, or info about an existing channel was changed. diff --git a/docs b/docs index f42967628..954549439 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f42967628f037daf1d60faae8049c58da1bd90a3 +Subproject commit 9545494397382ac8ebc073fc9e74fc97451f5fb0 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 3061d4903..43d08ca08 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + diff --git a/src/API.php b/src/API.php index a52f15ec1..901a653f9 100644 --- a/src/API.php +++ b/src/API.php @@ -51,7 +51,7 @@ final class API extends AbstractAPI * * @var string */ - public const RELEASE = '8.3.3'; + public const RELEASE = '8.3.4'; /** * We're not logged in. *