mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-26 19:24:42 +01:00
Fix getEventHandler when passing the class name of the main event handler class
This commit is contained in:
parent
e67ed5e5c2
commit
ac8869daf0
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit fde9838eb2e7cdd541f522410f61cac19a0c09d0
|
||||
Subproject commit ebe6a3f62fb93a903c7b203d0ab51cd09380bdb9
|
@ -44,6 +44,7 @@ abstract class MessageEntity implements JsonSerializable
|
||||
'italic', 'messageEntityItalic' => new Italic($entity['offset'], $entity['length']),
|
||||
'url', 'messageEntityUrl' => new Url($entity['offset'], $entity['length']),
|
||||
'code', 'messageEntityCode' => new Code($entity['offset'], $entity['length']),
|
||||
/** @psalm-suppress MixedArgument */
|
||||
'pre', 'messageEntityPre' => new Pre($entity['offset'], $entity['length'], $entity['language'] ?? ''),
|
||||
'text_link', 'messageEntityTextUrl' => new TextUrl($entity['offset'], $entity['length'], $entity['url']),
|
||||
'text_mention', 'messageEntityMentionName' => new MentionName($entity['offset'], $entity['length'], $entity['user_id'] ?? $entity['user']['id']),
|
||||
|
@ -363,6 +363,9 @@ final class Client extends ClientAbstract
|
||||
public function getEventHandler(?string $class = null): ?EventHandlerProxy
|
||||
{
|
||||
if ($class !== null) {
|
||||
if ($class === $this->getEventHandlerClass()) {
|
||||
return new EventHandlerProxy(null, $this);
|
||||
}
|
||||
return $this->getPlugin($class);
|
||||
}
|
||||
return $this->hasEventHandler() ? new EventHandlerProxy(null, $this) : null;
|
||||
|
@ -163,6 +163,13 @@ trait Events
|
||||
}
|
||||
return $this->event_handler_instance;
|
||||
}
|
||||
/** @internal */
|
||||
public function getEventHandlerClass(): ?string
|
||||
{
|
||||
return $this->event_handler_instance !== null
|
||||
? $this->event_handler_instance::class
|
||||
: null;
|
||||
}
|
||||
/**
|
||||
* Check if an event handler instance is present.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user