|
| 1 | +# Pyrogram - Telegram MTProto API Client Library for Python |
| 2 | +# Copyright (C) 2017-present <https://github.com/TelegramPlayGround> |
| 3 | +# |
| 4 | +# This file is part of Pyrogram. |
| 5 | +# |
| 6 | +# Pyrogram is free software: you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU Lesser General Public License as published |
| 8 | +# by the Free Software Foundation, either version 3 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# Pyrogram is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU Lesser General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU Lesser General Public License |
| 17 | +# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +from typing import Optional |
| 20 | + |
| 21 | +import pyrogram |
| 22 | +from pyrogram import raw |
| 23 | + |
| 24 | +from ..object import Object |
| 25 | + |
| 26 | + |
| 27 | +class BusinessBotRights(Object): |
| 28 | + """Represents the rights of a business bot. |
| 29 | +
|
| 30 | + Parameters: |
| 31 | + can_reply (``bool``, *optional*): |
| 32 | + True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours. |
| 33 | +
|
| 34 | + can_read_messages (``bool``, *optional*): |
| 35 | + True, if the bot can mark incoming private messages as read. |
| 36 | +
|
| 37 | + can_delete_outgoing_messages (``bool``, *optional*): |
| 38 | + True, if the bot can delete messages sent by the bot. |
| 39 | +
|
| 40 | + can_delete_all_messages (``bool``, *optional*): |
| 41 | + True, if the bot can delete all private messages in managed chats. |
| 42 | +
|
| 43 | + can_edit_name (``bool``, *optional*): |
| 44 | + True, if the bot can edit the first and last name of the business account. |
| 45 | +
|
| 46 | + can_edit_bio (``bool``, *optional*): |
| 47 | + True, if the bot can edit the bio of the business account. |
| 48 | +
|
| 49 | + can_edit_profile_photo (``bool``, *optional*): |
| 50 | + True, if the bot can edit the profile photo of the business account. |
| 51 | +
|
| 52 | + can_edit_username (``bool``, *optional*): |
| 53 | + True, if the bot can edit the username of the business account. |
| 54 | +
|
| 55 | + can_change_gift_settings (``bool``, *optional*): |
| 56 | + True, if the bot can change the privacy settings pertaining to gifts for the business account. |
| 57 | +
|
| 58 | + can_view_gifts_and_stars (``bool``, *optional*): |
| 59 | + True, if the bot can view gifts and the amount of Telegram Stars owned by the business account. |
| 60 | +
|
| 61 | + can_convert_gifts_to_stars (``bool``, *optional*): |
| 62 | + True, if the bot can convert regular gifts owned by the business account to Telegram Stars. |
| 63 | + |
| 64 | + can_transfer_and_upgrade_gifts (``bool``, *optional*): |
| 65 | + True, if the bot can transfer and upgrade gifts owned by the business account. |
| 66 | +
|
| 67 | + can_transfer_stars (``bool``, *optional*): |
| 68 | + True, if the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts. |
| 69 | +
|
| 70 | + can_manage_stories (``bool``, *optional*): |
| 71 | + True, if the bot can post, edit and delete stories on behalf of the business account. |
| 72 | +
|
| 73 | + """ |
| 74 | + |
| 75 | + def __init__( |
| 76 | + self, |
| 77 | + *, |
| 78 | + can_reply: Optional[bool] = None, |
| 79 | + can_read_messages: Optional[bool] = None, |
| 80 | + can_delete_outgoing_messages: Optional[bool] = None, |
| 81 | + can_delete_all_messages: Optional[bool] = None, |
| 82 | + can_edit_name: Optional[bool] = None, |
| 83 | + can_edit_bio: Optional[bool] = None, |
| 84 | + can_edit_profile_photo: Optional[bool] = None, |
| 85 | + can_edit_username: Optional[bool] = None, |
| 86 | + can_change_gift_settings: Optional[bool] = None, |
| 87 | + can_view_gifts_and_stars: Optional[bool] = None, |
| 88 | + can_convert_gifts_to_stars: Optional[bool] = None, |
| 89 | + can_transfer_and_upgrade_gifts: Optional[bool] = None, |
| 90 | + can_transfer_stars: Optional[bool] = None, |
| 91 | + can_manage_stories: Optional[bool] = None, |
| 92 | + ): |
| 93 | + super().__init__() |
| 94 | + |
| 95 | + self.can_reply = can_reply |
| 96 | + self.can_read_messages = can_read_messages |
| 97 | + self.can_delete_outgoing_messages = can_delete_outgoing_messages |
| 98 | + self.can_delete_all_messages = can_delete_all_messages |
| 99 | + self.can_edit_name = can_edit_name |
| 100 | + self.can_edit_bio = can_edit_bio |
| 101 | + self.can_edit_profile_photo = can_edit_profile_photo |
| 102 | + self.can_edit_username = can_edit_username |
| 103 | + self.can_change_gift_settings = can_change_gift_settings |
| 104 | + self.can_view_gifts_and_stars = can_view_gifts_and_stars |
| 105 | + self.can_convert_gifts_to_stars = can_convert_gifts_to_stars |
| 106 | + self.can_transfer_and_upgrade_gifts = can_transfer_and_upgrade_gifts |
| 107 | + self.can_transfer_stars = can_transfer_stars |
| 108 | + self.can_manage_stories = can_manage_stories |
| 109 | + |
| 110 | + |
| 111 | + @staticmethod |
| 112 | + def _parse( |
| 113 | + client, |
| 114 | + business_bot_rights: "raw.types.BusinessBotRights" |
| 115 | + ) -> "BusinessBotRights": |
| 116 | + if not business_bot_rights: |
| 117 | + return None |
| 118 | + return BusinessBotRights( |
| 119 | + can_reply=business_bot_rights.reply, |
| 120 | + can_read_messages=business_bot_rights.read_messages, |
| 121 | + can_delete_outgoing_messages=business_bot_rights.delete_sent_messages, |
| 122 | + can_delete_all_messages=business_bot_rights.delete_received_messages, |
| 123 | + can_edit_name=business_bot_rights.edit_name, |
| 124 | + can_edit_bio=business_bot_rights.edit_bio, |
| 125 | + can_edit_profile_photo=business_bot_rights.edit_profile_photo, |
| 126 | + can_edit_username=business_bot_rights.edit_username, |
| 127 | + can_change_gift_settings=business_bot_rights.change_gift_settings, |
| 128 | + can_view_gifts_and_stars=business_bot_rights.view_gifts, |
| 129 | + can_convert_gifts_to_stars=business_bot_rights.sell_gifts, |
| 130 | + can_transfer_and_upgrade_gifts=business_bot_rights.transfer_and_upgrade_gifts, |
| 131 | + can_transfer_stars=business_bot_rights.transfer_stars, |
| 132 | + can_manage_stories=business_bot_rights.manage_stories, |
| 133 | + ) |
0 commit comments