mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Pyrofork: Rename StoriesPrivacy to StoriesPrivacyRules
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
e668180b14
commit
55abd409f3
8 changed files with 30 additions and 30 deletions
|
|
@ -27,7 +27,7 @@ to apply only a valid value among the expected ones.
|
|||
SentCodeType
|
||||
NextCodeType
|
||||
UserStatus
|
||||
StoriesPrivacy
|
||||
StoriesPrivacyRules
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
|
@ -46,4 +46,4 @@ to apply only a valid value among the expected ones.
|
|||
SentCodeType
|
||||
NextCodeType
|
||||
UserStatus
|
||||
StoriesPrivacy
|
||||
StoriesPrivacyRules
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ from .next_code_type import NextCodeType
|
|||
from .parse_mode import ParseMode
|
||||
from .poll_type import PollType
|
||||
from .sent_code_type import SentCodeType
|
||||
from .stories_privacy import StoriesPrivacy
|
||||
from .stories_privacy_rules import StoriesPrivacyRules
|
||||
from .user_status import UserStatus
|
||||
|
||||
__all__ = [
|
||||
|
|
@ -46,6 +46,6 @@ __all__ = [
|
|||
'ParseMode',
|
||||
'PollType',
|
||||
'SentCodeType',
|
||||
"StoriesPrivacy",
|
||||
"StoriesPrivacyRules",
|
||||
'UserStatus'
|
||||
]
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ from enum import auto
|
|||
from .auto_name import AutoName
|
||||
|
||||
|
||||
class StoriesPrivacy(AutoName):
|
||||
"""Poll type enumeration used in :obj:`~pyrogram.types.Story`."""
|
||||
class StoriesPrivacyRules(AutoName):
|
||||
"""Stories privacy rules type enumeration used in :obj:`~pyrogram.method.SendStory`."""
|
||||
|
||||
PUBLIC = auto()
|
||||
"Public stories"
|
||||
|
|
@ -32,7 +32,7 @@ class EditStory:
|
|||
self: "pyrogram.Client",
|
||||
story_id: int,
|
||||
channel_id: int = None,
|
||||
privacy: "enums.StoriesPrivacy" = None,
|
||||
privacy: "enums.StoriesPrivacyRules" = None,
|
||||
allowed_users: List[int] = None,
|
||||
denied_users: List[int] = None,
|
||||
allowed_chats: List[int] = None,
|
||||
|
|
@ -76,7 +76,7 @@ class EditStory:
|
|||
pass a file path as string to upload a new video that exists on your local machine, or
|
||||
pass a binary file-like object with its attribute ".name" set for in-memory uploads.
|
||||
|
||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacy`, *optional*):
|
||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacyRules`, *optional*):
|
||||
Story privacy.
|
||||
|
||||
allowed_chats (List of ``int``, *optional*):
|
||||
|
|
@ -126,7 +126,7 @@ class EditStory:
|
|||
privacy_rules = None
|
||||
|
||||
if privacy:
|
||||
privacy_rules = [types.StoriesPrivacy(type=privacy)]
|
||||
privacy_rules = [types.StoriesPrivacyRules(type=privacy)]
|
||||
|
||||
if animation:
|
||||
if isinstance(animation, str):
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class SendStory:
|
|||
async def send_story(
|
||||
self: "pyrogram.Client",
|
||||
channel_id: int = None,
|
||||
privacy: "enums.StoriesPrivacy" = None,
|
||||
privacy: "enums.StoriesPrivacyRules" = None,
|
||||
allowed_users: List[int] = None,
|
||||
denied_users: List[int] = None,
|
||||
allowed_chats: List[int] = None,
|
||||
|
|
@ -77,9 +77,9 @@ class SendStory:
|
|||
pass a file path as string to upload a new video that exists on your local machine, or
|
||||
pass a binary file-like object with its attribute ".name" set for in-memory uploads.
|
||||
|
||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacy`, *optional*):
|
||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacyRules`, *optional*):
|
||||
Story privacy.
|
||||
Defaults to :obj:`~pyrogram.enums.StoriesPrivacy.PUBLIC`
|
||||
Defaults to :obj:`~pyrogram.enums.StoriesPrivacyRules.PUBLIC`
|
||||
|
||||
allowed_chats (List of ``int``, *optional*):
|
||||
List of chat_id which participant allowed to view the story.
|
||||
|
|
@ -136,9 +136,9 @@ class SendStory:
|
|||
peer = await self.resolve_peer("me")
|
||||
|
||||
if privacy:
|
||||
privacy_rules = [types.StoriesPrivacy(type=privacy)]
|
||||
privacy_rules = [types.StoriesPrivacyRules(type=privacy)]
|
||||
else:
|
||||
privacy_rules = [types.StoriesPrivacy(type=enums.StoriesPrivacy.PUBLIC)]
|
||||
privacy_rules = [types.StoriesPrivacyRules(type=enums.StoriesPrivacyRules.PUBLIC)]
|
||||
|
||||
if animation:
|
||||
if isinstance(animation, str):
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from .poll_option import PollOption
|
|||
from .reaction import Reaction
|
||||
from .sticker import Sticker
|
||||
from .stickerset import StickerSet
|
||||
from .stories_privacy import StoriesPrivacy
|
||||
from .stories_privacy_rules import StoriesPrivacyRules
|
||||
from .stripped_thumbnail import StrippedThumbnail
|
||||
from .thumbnail import Thumbnail
|
||||
from .venue import Venue
|
||||
|
|
@ -51,5 +51,5 @@ from .exported_story_link import ExportedStoryLink
|
|||
__all__ = [
|
||||
"Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Photo", "Thumbnail",
|
||||
"StrippedThumbnail", "Poll", "PollOption", "Sticker", "StickerSet", "Venue", "Video", "VideoNote", "Voice", "WebPage", "Dice",
|
||||
"Reaction", "WebAppData", "MessageReactions", "MessageStory", "Story", "StoryDeleted", "StorySkipped", "StoryViews", "StoriesPrivacy", "ExportedStoryLink"
|
||||
"Reaction", "WebAppData", "MessageReactions", "MessageStory", "Story", "StoryDeleted", "StorySkipped", "StoryViews", "StoriesPrivacyRules", "ExportedStoryLink"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -19,29 +19,29 @@
|
|||
from pyrogram import enums, raw
|
||||
from ..object import Object
|
||||
|
||||
class StoriesPrivacy(Object):
|
||||
class StoriesPrivacyRules(Object):
|
||||
"""A story privacy.
|
||||
|
||||
Parameters:
|
||||
type (:obj:`~pyrogram.enums.StoriesPrivacy`):
|
||||
type (:obj:`~pyrogram.enums.StoriesPrivacyRules`):
|
||||
Story privacy type.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, *,
|
||||
type: "enums.StoriesPrivacy"
|
||||
type: "enums.StoriesPrivacyRules"
|
||||
):
|
||||
super().__init__()
|
||||
self.type = type
|
||||
|
||||
def write(self):
|
||||
if self.type == enums.StoriesPrivacy.PUBLIC:
|
||||
if self.type == enums.StoriesPrivacyRules.PUBLIC:
|
||||
return raw.types.InputPrivacyValueAllowAll().write()
|
||||
if self.type == enums.StoriesPrivacy.CLOSE_FRIENDS:
|
||||
if self.type == enums.StoriesPrivacyRules.CLOSE_FRIENDS:
|
||||
return raw.types.InputPrivacyValueAllowCloseFriends().write()
|
||||
if self.type == enums.StoriesPrivacy.CONTACTS:
|
||||
if self.type == enums.StoriesPrivacyRules.CONTACTS:
|
||||
return raw.types.InputPrivacyValueAllowContacts().write()
|
||||
if self.type == enums.StoriesPrivacy.NO_CONTACTS:
|
||||
if self.type == enums.StoriesPrivacyRules.NO_CONTACTS:
|
||||
return raw.types.InputPrivacyValueDisallowContacts().write()
|
||||
if self.type == enums.StoriesPrivacy.PRIVATE:
|
||||
if self.type == enums.StoriesPrivacyRules.PRIVATE:
|
||||
return raw.types.InputPrivacyValueDisallowAll().write()
|
||||
|
|
@ -1364,7 +1364,7 @@ class Story(Object, Update):
|
|||
|
||||
async def edit(
|
||||
self,
|
||||
privacy: "enums.StoriesPrivacy" = None,
|
||||
privacy: "enums.StoriesPrivacyRules" = None,
|
||||
allowed_users: List[int] = None,
|
||||
denied_users: List[int] = None,
|
||||
allowed_chats: List[int] = None,
|
||||
|
|
@ -1418,7 +1418,7 @@ class Story(Object, Update):
|
|||
channel=self.sender_chat.id if self.sender_chat else None,new video that exists on your local machine, or
|
||||
pass a binary file-like object with its attribute ".name" set for in-memory uploads.
|
||||
|
||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacy`, *optional*):
|
||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacyRules`, *optional*):
|
||||
Story privacy.
|
||||
|
||||
allowed_chats (List of ``int``, *optional*):
|
||||
|
|
@ -1548,7 +1548,7 @@ class Story(Object, Update):
|
|||
|
||||
async def edit_privacy(
|
||||
self,
|
||||
privacy: "enums.StoriesPrivacy" = None,
|
||||
privacy: "enums.StoriesPrivacyRules" = None,
|
||||
allowed_users: List[int] = None,
|
||||
denied_users: List[int] = None,
|
||||
allowed_chats: List[int] = None,
|
||||
|
|
@ -1562,16 +1562,16 @@ class Story(Object, Update):
|
|||
|
||||
await client.edit_story(
|
||||
story_id=story.id,
|
||||
privacy=enums.StoriesPrivacy.PUBLIC
|
||||
privacy=enums.StoriesPrivacyRules.PUBLIC
|
||||
)
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
await story.edit_privacy(enums.StoriesPrivacy.PUBLIC)
|
||||
await story.edit_privacy(enums.StoriesPrivacyRules.PUBLIC)
|
||||
|
||||
Parameters:
|
||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacy`, *optional*):
|
||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacyRules`, *optional*):
|
||||
Story privacy.
|
||||
|
||||
allowed_chats (List of ``int``, *optional*):
|
||||
|
|
|
|||
Loading…
Reference in a new issue