2023-07-01 13:04:59 +02:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace danog\MadelineProto\EventHandler\Message;
|
|
|
|
|
|
|
|
use danog\MadelineProto\EventHandler\Message;
|
|
|
|
use danog\MadelineProto\MTProto;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents an incoming or outgoing group message.
|
|
|
|
*/
|
2023-07-01 18:04:20 +02:00
|
|
|
abstract class GroupMessage extends Message
|
2023-07-01 13:04:59 +02:00
|
|
|
{
|
|
|
|
/** ID of the sender of the message (equal to the chatId for anonymous admins) */
|
|
|
|
public readonly int $senderId;
|
|
|
|
|
|
|
|
/** @internal */
|
2023-07-01 18:04:20 +02:00
|
|
|
protected function __construct(
|
2023-07-01 13:04:59 +02:00
|
|
|
MTProto $API,
|
2023-07-04 18:19:06 +02:00
|
|
|
array $rawMessage,
|
|
|
|
bool $outgoing
|
2023-07-01 13:04:59 +02:00
|
|
|
) {
|
2023-07-04 18:19:06 +02:00
|
|
|
parent::__construct($API, $rawMessage, $outgoing);
|
2023-07-01 13:04:59 +02:00
|
|
|
|
|
|
|
$this->senderId = isset($rawMessage['from_id'])
|
2023-07-01 19:06:30 +02:00
|
|
|
? $this->API->getIdInternal($rawMessage['from_id'])
|
2023-07-01 13:04:59 +02:00
|
|
|
: $this->chatId;
|
|
|
|
}
|
|
|
|
}
|