mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 09:38:57 +01:00
Improve performance a bit
This commit is contained in:
parent
48e17f6ff2
commit
ccf83d3aee
@ -44,9 +44,9 @@ abstract class AbstractMessage extends Update implements SimpleFilters
|
||||
public function __construct(
|
||||
MTProto $API,
|
||||
array $rawMessage,
|
||||
array $info
|
||||
) {
|
||||
parent::__construct($API);
|
||||
$info = $this->API->getInfo($rawMessage);
|
||||
|
||||
$this->out = $rawMessage['out'];
|
||||
$this->id = $rawMessage['id'];
|
||||
|
@ -76,9 +76,9 @@ abstract class Message extends AbstractMessage
|
||||
public function __construct(
|
||||
MTProto $API,
|
||||
array $rawMessage,
|
||||
array $info,
|
||||
) {
|
||||
parent::__construct($API, $rawMessage);
|
||||
$info = $this->API->getInfo($rawMessage);
|
||||
parent::__construct($API, $rawMessage, $info);
|
||||
|
||||
$this->entities = $rawMessage['entities'] ?? null;
|
||||
$this->message = $rawMessage['message'];
|
||||
|
@ -18,9 +18,10 @@ final class ChannelMessage extends Message
|
||||
/** @internal */
|
||||
public function __construct(
|
||||
MTProto $API,
|
||||
array $rawMessage
|
||||
array $rawMessage,
|
||||
array $info
|
||||
) {
|
||||
parent::__construct($API, $rawMessage);
|
||||
parent::__construct($API, $rawMessage, $info);
|
||||
|
||||
$this->views = $rawMessage['views'];
|
||||
$this->signature = $rawMessage['post_author'] ?? null;
|
||||
|
@ -381,14 +381,14 @@ trait UpdateHandler
|
||||
default => null
|
||||
};
|
||||
}
|
||||
$id = $this->getIdInternal($message);
|
||||
if (($this->chats[$id]['username'] ?? '') === 'replies') {
|
||||
$info = $this->getInfo($message);
|
||||
if (($this->chats[$info['bot_api_id']]['username'] ?? '') === 'replies') {
|
||||
return null;
|
||||
}
|
||||
return match ($this->getType($id)) {
|
||||
API::PEER_TYPE_BOT, API::PEER_TYPE_USER => new PrivateMessage($this, $message),
|
||||
API::PEER_TYPE_GROUP, API::PEER_TYPE_SUPERGROUP => new GroupMessage($this, $message),
|
||||
API::PEER_TYPE_CHANNEL => new ChannelMessage($this, $message),
|
||||
return match ($info['type']) {
|
||||
API::PEER_TYPE_BOT, API::PEER_TYPE_USER => new PrivateMessage($this, $message, $info),
|
||||
API::PEER_TYPE_GROUP, API::PEER_TYPE_SUPERGROUP => new GroupMessage($this, $message, $info),
|
||||
API::PEER_TYPE_CHANNEL => new ChannelMessage($this, $message, $info),
|
||||
};
|
||||
}
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user