1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 10:38:59 +01:00

fix data type, change method

This commit is contained in:
َAhJ 2023-08-30 13:08:05 +03:30
parent 4b1cbb1797
commit 85225936db
5 changed files with 14 additions and 11 deletions

View File

@ -17,6 +17,7 @@
namespace danog\MadelineProto\EventHandler\Participant;
use danog\MadelineProto\EventHandler\Participant;
use danog\MadelineProto\EventHandler\Participant\Rights\Admin as AdminRights;
/**
* Admin
@ -42,7 +43,7 @@ class Admin extends Participant
public readonly int $date;
/** Admin [rights](https://core.telegram.org/api/rights) */
public readonly bool $adminRights; //!
public readonly AdminRights $adminRights;
/** The role (rank) of the admin in the group: just an arbitrary string, `admin` by default */
public readonly string $rank;
@ -57,7 +58,7 @@ class Admin extends Participant
$this->inviterId = $rawParticipant['inviter_id'] ?? null;
$this->promotedBy = $rawParticipant['promoted_by'];
$this->date = $rawParticipant['date'];
$this->rank = $rawParticipant['rank'] ?? '';
$this->adminRights = new Rights\Admin($rawParticipant['admin_rights']);
$this->rank = $rawParticipant['rank'] ?? 'admin';
$this->adminRights = new AdminRights($rawParticipant['admin_rights']);
}
}

View File

@ -17,6 +17,7 @@
namespace danog\MadelineProto\EventHandler\Participant;
use danog\MadelineProto\EventHandler\Participant;
use danog\MadelineProto\EventHandler\Participant\Rights\Banned as BannedRights;
use danog\MadelineProto\MTProto;
/**
@ -37,7 +38,7 @@ class Banned extends Participant
public readonly ?int $date;
/** Banned [rights](https://core.telegram.org/api/rights) */
public readonly bool $bannedRights; //!
public readonly BannedRights $bannedRights;
/** @internal */
public function __construct(
@ -45,9 +46,9 @@ class Banned extends Participant
array $rawParticipant
) {
$this->left = $rawParticipant['left'];
$this->peer = $API->getId($rawParticipant['peer']);
$this->peer = $API->getIdInternal ($rawParticipant['peer']);
$this->kickedBy = $rawParticipant['kicked_by'];
$this->date = $rawParticipant['date'];
$this->bannedRights = new Rights\Banned($rawParticipant['banned_rights']);
$this->bannedRights = new BannedRights($rawParticipant['banned_rights']);
}
}

View File

@ -17,6 +17,7 @@
namespace danog\MadelineProto\EventHandler\Participant;
use danog\MadelineProto\EventHandler\Participant;
use danog\MadelineProto\EventHandler\Participant\Rights\Admin as AdminRights;
/**
* Channel/supergroup creator
@ -27,7 +28,7 @@ class Creator extends Participant
public readonly int $userId;
/** Creator admin rights */
public readonly int $adminRights; //!
public readonly AdminRights $adminRights;
/** The role (rank) of the group creator in the group: just an arbitrary string, `admin` by default */
public readonly string $rank;
@ -37,7 +38,7 @@ class Creator extends Participant
array $rawParticipant
) {
$this->userId = $rawParticipant['user_id'];
$this->adminRights = new Rights\Admin($rawParticipant['adminRights']);
$this->rank = $rawParticipant['rank'] ?? '';
$this->adminRights = new AdminRights($rawParticipant['adminRights']);
$this->rank = $rawParticipant['rank'] ?? 'Owner';
}
}

View File

@ -33,6 +33,6 @@ class Left extends Participant
MTProto $API,
array $rawParticipant
) {
$this->peer = $API->getId($rawParticipant['peer']);
$this->peer = $API->getIdInternal ($rawParticipant['peer']);
}
}

View File

@ -33,7 +33,7 @@ class MySelf extends Participant
public readonly ?int $inviterId;
/** When did I join the channel/supergroup */
public readonly ?int $date;
public readonly int $date;
/** @internal */
public function __construct(