-
-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Some Bounded methods #1395
Add Some Bounded methods #1395
Conversation
src/EventHandler/Participant.php
Outdated
use ReflectionProperty; | ||
|
||
/** | ||
* The channel participant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Info about a channel participant
public readonly int $date; | ||
|
||
/** Admin [rights](https://core.telegram.org/api/rights) */ | ||
public readonly bool $adminRights; //! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not bool :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh some drug XD
$this->inviterId = $rawParticipant['inviter_id'] ?? null; | ||
$this->promotedBy = $rawParticipant['promoted_by']; | ||
$this->date = $rawParticipant['date']; | ||
$this->rank = $rawParticipant['rank'] ?? ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use ?? null and make the rank nullable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe do ?? 'admin', since that's how the GUI clients do it...
* You should have received a copy of the GNU General Public License along with MadelineProto. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* @author Daniil Gentili <daniil@daniil.it> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW you can put yourself as author on the files you made :)
public readonly ?int $date; | ||
|
||
/** Banned [rights](https://core.telegram.org/api/rights) */ | ||
public readonly bool $bannedRights; //! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not bool :)
public readonly int $userId; | ||
|
||
/** Creator admin rights */ | ||
public readonly int $adminRights; //! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an int :)
) { | ||
$this->userId = $rawParticipant['user_id']; | ||
$this->adminRights = new Rights\Admin($rawParticipant['adminRights']); | ||
$this->rank = $rawParticipant['rank'] ?? ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?? 'admin', probably
array $rawParticipant | ||
) { | ||
$this->left = $rawParticipant['left']; | ||
$this->peer = $API->getId($rawParticipant['peer']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use getIdInternal here, it's faster
MTProto $API, | ||
array $rawParticipant | ||
) { | ||
$this->peer = $API->getId($rawParticipant['peer']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use getIdInternal here, it's faster
/** | ||
* A participant that left the channel/supergroup | ||
*/ | ||
class Left extends Participant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw you should make all classes either final or abstract
public readonly ?int $inviterId; | ||
|
||
/** When did I join the channel/supergroup */ | ||
public readonly ?int $date; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not nullable
public readonly bool $sendVideos; | ||
|
||
/** If set, does not allow a user to send round videos in a [supergroup/chat](https://core.telegram.org/api/channel) */ | ||
public readonly bool $send_roundvideos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sendRoundVideos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks amazing, thank you so much!
Just a few small tweaks :)
* | ||
* @return boolean | ||
*/ | ||
public function disableSignatures(): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can return void in both
use danog\MadelineProto\EventHandler\Message\ServiceMessage; | ||
use danog\MadelineProto\MTProto; | ||
|
||
/** @internal */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mark only the constructor as @internal
, not the class pls
use ReflectionClass; | ||
use ReflectionProperty; | ||
|
||
/** @internal */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to mark this as internal
/** | ||
* The group call has ended. | ||
*/ | ||
final class Called extends AbstractDialogCallGroup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name the namespace DialogGroupCall
?
Also, can we just name the class GroupCallEnded
? I don't like using such non-descriptive names for the class (even if more info is included in the namespace).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for the other classes in the DialogGroupCall namespace
/** | ||
* Why call ended | ||
*/ | ||
enum PhoneCallDiscardReason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use src/VoIP/DiscardReason.php
, instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but can I add a fromString method?
Or I should handle it in DialogPhoneCall class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
Thank you! <3<3<3 |
No description provided.