. * * @author Daniil Gentili * @copyright 2016-2023 Daniil Gentili * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\EventHandler\Participant; use danog\MadelineProto\EventHandler\Participant; use danog\MadelineProto\EventHandler\Participant\Rights\Banned as BannedRights; use danog\MadelineProto\MTProtoTools\DialogId; /** * Banned/kicked user. */ final class Banned extends Participant { /** Whether the user has left the group */ public readonly bool $left; /** The banned peer */ public readonly int $peer; /** User was kicked by the specified admin */ public readonly int $kickedBy; /** When did the user join the group */ public readonly int $date; /** Banned [rights](https://core.telegram.org/api/rights) */ public readonly BannedRights $bannedRights; /** @internal */ public function __construct(array $rawParticipant) { $peer = $rawParticipant['peer']; $this->left = $rawParticipant['left']; $this->kickedBy = $rawParticipant['kicked_by']; $this->date = $rawParticipant['date']; $this->bannedRights = new BannedRights($rawParticipant['banned_rights']); $this->peer = match ($peer['_']) { 'peerUser' => $peer['user_id'], 'peerChat' => -$peer['chat_id'], 'peerChannel' => DialogId::fromSupergroupOrChannel($peer['channel_id']), }; } }