Source code for pyrogram.raw.types.business_away_message
# 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 BusinessAwayMessage(TLObject): # type: ignore
"""Describes a `Telegram Business away message <https://core.telegram.org/api/business#away-messages>`_, automatically sent to users writing to us when we're offline, during closing hours, while we're on vacation, or in some other custom time period when we cannot immediately answer to the user.
Constructor of :obj:`~pyrogram.raw.base.BusinessAwayMessage`.
Details:
- Layer: ``229``
- ID: ``EF156A5C``
Parameters:
shortcut_id (``int`` ``32-bit``):
ID of a `quick reply shorcut, containing the away messages to send, see here ยป for more info <https://core.telegram.org/api/business#quick-reply-shortcuts>`_.
schedule (:obj:`BusinessAwayMessageSchedule <pyrogram.raw.base.BusinessAwayMessageSchedule>`):
Specifies when should the away messages be sent.
recipients (:obj:`BusinessRecipients <pyrogram.raw.base.BusinessRecipients>`):
Allowed recipients for the away messages.
offline_only (``bool``, *optional*):
If set, the messages will not be sent if the account was online in the last 10 minutes.
"""
__slots__: List[str] = ["shortcut_id", "schedule", "recipients", "offline_only"]
ID = 0xef156a5c
QUALNAME = "types.BusinessAwayMessage"
def __init__(self, *, shortcut_id: int, schedule: "raw.base.BusinessAwayMessageSchedule", recipients: "raw.base.BusinessRecipients", offline_only: Optional[bool] = None) -> None:
self.shortcut_id = shortcut_id # int
self.schedule = schedule # BusinessAwayMessageSchedule
self.recipients = recipients # BusinessRecipients
self.offline_only = offline_only # flags.0?true
@staticmethod
def read(b: BytesIO, *args: Any) -> "BusinessAwayMessage":
flags = Int.read(b)
offline_only = True if flags & (1 << 0) else False
shortcut_id = Int.read(b)
schedule = TLObject.read(b)
recipients = TLObject.read(b)
return BusinessAwayMessage(shortcut_id=shortcut_id, schedule=schedule, recipients=recipients, offline_only=offline_only)
def write(self, *args) -> bytes:
b = BytesIO()
b.write(Int(self.ID, False))
flags = 0
flags |= (1 << 0) if self.offline_only else 0
b.write(Int(flags))
b.write(Int(self.shortcut_id))
b.write(self.schedule.write())
b.write(self.recipients.write())
return b.getvalue()