1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 22:34:42 +01:00

Compare commits

...

5 Commits

Author SHA1 Message Date
77211064e9 Bump to 8.3.4 2024-10-19 15:09:41 +00:00
bcc493b7a5 Peer database bugfix 2024-10-19 15:04:04 +00:00
96501b64f6
Merge pull request #1558 from Piagrammist/v8
Fix `ChannelParticipant::newParticipant` default value
2024-10-19 17:04:01 +02:00
Piagrammist
0305abeee2 Improve comments wording 2024-09-27 20:16:31 +03:30
Piagrammist
016528faa9 Fix: ChannelParticipant::newParticipant default value must be set to Left 2024-09-27 20:13:10 +03:30
6 changed files with 10 additions and 11 deletions

View File

@ -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\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\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\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\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\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. * [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.

2
docs

@ -1 +1 @@
Subproject commit f42967628f037daf1d60faae8049c58da1bd90a3 Subproject commit 9545494397382ac8ebc073fc9e74fc97451f5fb0

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@16b24bdc94e052b5ce69fd232a77416a1f6ec3e6"> <files psalm-version="dev-master@dee5fe4e848ebe974581cf92bb59abe868b3367a">
<file src="src/API.php"> <file src="src/API.php">
<ArgumentTypeCoercion> <ArgumentTypeCoercion>
<code><![CDATA[$settings]]></code> <code><![CDATA[$settings]]></code>

View File

@ -51,7 +51,7 @@ final class API extends AbstractAPI
* *
* @var string * @var string
*/ */
public const RELEASE = '8.3.3'; public const RELEASE = '8.3.4';
/** /**
* We're not logged in. * We're not logged in.
* *

View File

@ -11,7 +11,7 @@
* @author Amir Hossein Jafari <amirhosseinjafari8228@gmail.com> * @author Amir Hossein Jafari <amirhosseinjafari8228@gmail.com>
* @copyright 2016-2023 Amir Hossein Jafari <amirhosseinjafari8228@gmail.com> * @copyright 2016-2023 Amir Hossein Jafari <amirhosseinjafari8228@gmail.com>
* @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @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; namespace danog\MadelineProto\EventHandler\Channel;
@ -19,12 +19,11 @@ namespace danog\MadelineProto\EventHandler\Channel;
use danog\MadelineProto\EventHandler\ChatInvite; use danog\MadelineProto\EventHandler\ChatInvite;
use danog\MadelineProto\EventHandler\Participant; use danog\MadelineProto\EventHandler\Participant;
use danog\MadelineProto\EventHandler\Participant\Left; use danog\MadelineProto\EventHandler\Participant\Left;
use danog\MadelineProto\EventHandler\Participant\Member;
use danog\MadelineProto\EventHandler\Update; use danog\MadelineProto\EventHandler\Update;
use danog\MadelineProto\MTProto; 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 final class ChannelParticipant extends Update
{ {
@ -63,13 +62,13 @@ final class ChannelParticipant extends Update
$this->inviteLink = isset($rawChannelParticipant['invite']) $this->inviteLink = isset($rawChannelParticipant['invite'])
? ChatInvite::fromRawChatInvite($rawChannelParticipant['invite']) ? ChatInvite::fromRawChatInvite($rawChannelParticipant['invite'])
: null; : null;
// If null, user lefted channel // If null, user wasn't a participant.
$this->prevParticipant = isset($rawChannelParticipant['prev_participant']) $this->prevParticipant = isset($rawChannelParticipant['prev_participant'])
? Participant::fromRawParticipant($rawChannelParticipant['prev_participant']) ? Participant::fromRawParticipant($rawChannelParticipant['prev_participant'])
: new Left(['peer' => $this->userId]); : new Left(['peer' => $this->userId]);
// if null, user joind // If null, user has left.
$this->newParticipant = isset($rawChannelParticipant['new_participant']) $this->newParticipant = isset($rawChannelParticipant['new_participant'])
? Participant::fromRawParticipant($rawChannelParticipant['new_participant']) ? Participant::fromRawParticipant($rawChannelParticipant['new_participant'])
: new Member(['user_id' => $this->userId, 'date' => $this->date]); : new Left(['peer' => $this->userId]);
} }
} }

View File

@ -265,7 +265,7 @@ final class PeerDatabase implements TLCallback
if (!$this->API->settings->getDb()->getEnableUsernameDb()) { if (!$this->API->settings->getDb()->getEnableUsernameDb()) {
return; return;
} }
$new = self::getUsernames($new); $new = $new ? self::getUsernames($new) : [];
$old = $old ? self::getUsernames($old) : []; $old = $old ? self::getUsernames($old) : [];
$diffToRemove = array_diff($old, $new); $diffToRemove = array_diff($old, $new);
$diffToAdd = array_diff($new, $old); $diffToAdd = array_diff($new, $old);