Source code for pyrogram.raw.types.reactions_notify_settings

#  Pyrogram - Telegram MTProto API Client Library for Python
#  Copyright (C) 2017-present Dan <https://github.com/delivrance>
#
#  This file is part of Pyrogram.
#
#  Pyrogram is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Lesser General Public License as published
#  by the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  Pyrogram is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public License
#  along with Pyrogram.  If not, see <http://www.gnu.org/licenses/>.

from io import BytesIO

from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector
from pyrogram.raw.core import TLObject
from pyrogram import raw
from typing import List, Optional, Any

# # # # # # # # # # # # # # # # # # # # # # # #
#               !!! WARNING !!!               #
#          This is a generated file!          #
# All changes made in this file will be lost! #
# # # # # # # # # # # # # # # # # # # # # # # #


[docs] class ReactionsNotifySettings(TLObject): # type: ignore """Reaction notification settings, see `here » <https://core.telegram.org/api/reactions#notifications-about-reactions>`_ for more info. Constructor of :obj:`~pyrogram.raw.base.ReactionsNotifySettings`. Details: - Layer: ``229`` - ID: ``71E4EA58`` Parameters: sound (:obj:`NotificationSound <pyrogram.raw.base.NotificationSound>`): `Notification sound for reactions » <https://core.telegram.org/api/ringtones>`_ show_previews (``bool``): If false, `push notifications » <https://core.telegram.org/api/push-updates>`_ about message/story reactions will only be of type ``REACT_HIDDEN`` / ``REACT_STORY_HIDDEN``, without any information about the reacted-to story or the reaction itself. messages_notify_from (:obj:`ReactionNotificationsFrom <pyrogram.raw.base.ReactionNotificationsFrom>`, *optional*): Message reaction notification settings, if not set completely disables notifications/updates about message reactions. stories_notify_from (:obj:`ReactionNotificationsFrom <pyrogram.raw.base.ReactionNotificationsFrom>`, *optional*): Story reaction notification settings, if not set completely disables notifications/updates about reactions to stories. poll_votes_notify_from (:obj:`ReactionNotificationsFrom <pyrogram.raw.base.ReactionNotificationsFrom>`, *optional*): `Non-anonymous poll vote » <https://core.telegram.org/api/poll#unread-poll-votes>`_ notification settings, if not set completely disables notifications/updates about votes cast in the user's non-anonymous polls. Functions: This object can be returned by 2 functions. .. currentmodule:: pyrogram.raw.functions .. autosummary:: :nosignatures: account.GetReactionsNotifySettings account.SetReactionsNotifySettings """ __slots__: List[str] = ["sound", "show_previews", "messages_notify_from", "stories_notify_from", "poll_votes_notify_from"] ID = 0x71e4ea58 QUALNAME = "types.ReactionsNotifySettings" def __init__(self, *, sound: "raw.base.NotificationSound", show_previews: bool, messages_notify_from: "raw.base.ReactionNotificationsFrom" = None, stories_notify_from: "raw.base.ReactionNotificationsFrom" = None, poll_votes_notify_from: "raw.base.ReactionNotificationsFrom" = None) -> None: self.sound = sound # NotificationSound self.show_previews = show_previews # Bool self.messages_notify_from = messages_notify_from # flags.0?ReactionNotificationsFrom self.stories_notify_from = stories_notify_from # flags.1?ReactionNotificationsFrom self.poll_votes_notify_from = poll_votes_notify_from # flags.2?ReactionNotificationsFrom @staticmethod def read(b: BytesIO, *args: Any) -> "ReactionsNotifySettings": flags = Int.read(b) messages_notify_from = TLObject.read(b) if flags & (1 << 0) else None stories_notify_from = TLObject.read(b) if flags & (1 << 1) else None poll_votes_notify_from = TLObject.read(b) if flags & (1 << 2) else None sound = TLObject.read(b) show_previews = Bool.read(b) return ReactionsNotifySettings(sound=sound, show_previews=show_previews, messages_notify_from=messages_notify_from, stories_notify_from=stories_notify_from, poll_votes_notify_from=poll_votes_notify_from) def write(self, *args) -> bytes: b = BytesIO() b.write(Int(self.ID, False)) flags = 0 flags |= (1 << 0) if self.messages_notify_from is not None else 0 flags |= (1 << 1) if self.stories_notify_from is not None else 0 flags |= (1 << 2) if self.poll_votes_notify_from is not None else 0 b.write(Int(flags)) if self.messages_notify_from is not None: b.write(self.messages_notify_from.write()) if self.stories_notify_from is not None: b.write(self.stories_notify_from.write()) if self.poll_votes_notify_from is not None: b.write(self.poll_votes_notify_from.write()) b.write(self.sound.write()) b.write(Bool(self.show_previews)) return b.getvalue()