. * * @author Amir Hossein Jafari * @copyright 2016-2023 Amir Hossein Jafari * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 * @link https://docs.madelineproto.xyz MadelineProto documentation */ namespace danog\MadelineProto\EventHandler; use danog\MadelineProto\MTProto; use danog\MadelineProto\MTProtoTools\DialogId; /** * Represents messages s were pinned/unpinned. */ abstract class Pinned extends Update { /** Whether the messages were pinned or unpinned. */ public readonly bool $pinned; /** @var list List of identifiers of pinned messages. */ public readonly array $ids; /** ID of the chat where the messages were pinned. */ public readonly int $chatId; /** @internal */ public function __construct(MTProto $API, array $rawPinned) { parent::__construct($API); $this->pinned = $rawPinned['pinned']; $this->ids = $rawPinned['messages']; $this->chatId = isset($rawPinned['channel_id']) ? DialogId::fromSupergroupOrChannel($rawPinned['channel_id']) : $API->getIdInternal($rawPinned['peer']); } }