. * * @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\Admin as AdminRights; /** * Admin. */ final class Admin extends Participant { /** Can this admin promote other admins with the same permissions? */ public readonly bool $canEdit; /** Is this the current user */ public readonly bool $self; /** Admin user ID */ public readonly int $userId; /** User that invited the admin to the channel/group */ public readonly ?int $inviterId; /** User that promoted the user to admin */ public readonly int $promotedBy; /** When did the user join */ public readonly int $date; /** Admin [rights](https://core.telegram.org/api/rights) */ public readonly AdminRights $adminRights; /** The role (rank) of the admin in the group: just an arbitrary string, `admin` by default */ public readonly string $rank; /** @internal */ public function __construct( array $rawParticipant ) { $this->canEdit = $rawParticipant['can_edit']; $this->self = $rawParticipant['self']; $this->userId = $rawParticipant['user_id']; $this->inviterId = $rawParticipant['inviter_id'] ?? null; $this->promotedBy = $rawParticipant['promoted_by']; $this->date = $rawParticipant['date']; $this->rank = $rawParticipant['rank'] ?? 'admin'; $this->adminRights = new AdminRights($rawParticipant['admin_rights']); } }