From 016528faa9078d9a85867254d3bfe14a72d9f798 Mon Sep 17 00:00:00 2001 From: Piagrammist Date: Fri, 27 Sep 2024 20:13:10 +0330 Subject: [PATCH 1/2] 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/2] 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]);