. * * @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\EventHandler\Privacy\Rule; use danog\MadelineProto\EventHandler\Privacy\RuleDestination; use danog\MadelineProto\MTProto; /** * Indicates some privacy rules for a user or set of users. */ final class Privacy extends Update { /** New privacy rule. */ public readonly Rule $rule; /** @var list Peers to which the privacy rules apply */ public readonly array $appliesTo; /** @internal */ public function __construct(MTProto $API, array $rawPrivacy) { parent::__construct($API); $this->rule = Rule::fromRawKey($rawPrivacy['key']['_']); $this->appliesTo = \array_map(RuleDestination::fromRawRule(...), $rawPrivacy['rules']); } }