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
|
SentCodeType
|
||||||
NextCodeType
|
NextCodeType
|
||||||
UserStatus
|
UserStatus
|
||||||
StoriesPrivacy
|
StoriesPrivacyRules
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:hidden:
|
:hidden:
|
||||||
|
|
@ -46,4 +46,4 @@ to apply only a valid value among the expected ones.
|
||||||
SentCodeType
|
SentCodeType
|
||||||
NextCodeType
|
NextCodeType
|
||||||
UserStatus
|
UserStatus
|
||||||
StoriesPrivacy
|
StoriesPrivacyRules
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ from .next_code_type import NextCodeType
|
||||||
from .parse_mode import ParseMode
|
from .parse_mode import ParseMode
|
||||||
from .poll_type import PollType
|
from .poll_type import PollType
|
||||||
from .sent_code_type import SentCodeType
|
from .sent_code_type import SentCodeType
|
||||||
from .stories_privacy import StoriesPrivacy
|
from .stories_privacy_rules import StoriesPrivacyRules
|
||||||
from .user_status import UserStatus
|
from .user_status import UserStatus
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
@ -46,6 +46,6 @@ __all__ = [
|
||||||
'ParseMode',
|
'ParseMode',
|
||||||
'PollType',
|
'PollType',
|
||||||
'SentCodeType',
|
'SentCodeType',
|
||||||
"StoriesPrivacy",
|
"StoriesPrivacyRules",
|
||||||
'UserStatus'
|
'UserStatus'
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@ from enum import auto
|
||||||
from .auto_name import AutoName
|
from .auto_name import AutoName
|
||||||
|
|
||||||
|
|
||||||
class StoriesPrivacy(AutoName):
|
class StoriesPrivacyRules(AutoName):
|
||||||
"""Poll type enumeration used in :obj:`~pyrogram.types.Story`."""
|
"""Stories privacy rules type enumeration used in :obj:`~pyrogram.method.SendStory`."""
|
||||||
|
|
||||||
PUBLIC = auto()
|
PUBLIC = auto()
|
||||||
"Public stories"
|
"Public stories"
|
||||||
|
|
@ -32,7 +32,7 @@ class EditStory:
|
||||||
self: "pyrogram.Client",
|
self: "pyrogram.Client",
|
||||||
story_id: int,
|
story_id: int,
|
||||||
channel_id: int = None,
|
channel_id: int = None,
|
||||||
privacy: "enums.StoriesPrivacy" = None,
|
privacy: "enums.StoriesPrivacyRules" = None,
|
||||||
allowed_users: List[int] = None,
|
allowed_users: List[int] = None,
|
||||||
denied_users: List[int] = None,
|
denied_users: List[int] = None,
|
||||||
allowed_chats: 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 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.
|
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.
|
Story privacy.
|
||||||
|
|
||||||
allowed_chats (List of ``int``, *optional*):
|
allowed_chats (List of ``int``, *optional*):
|
||||||
|
|
@ -126,7 +126,7 @@ class EditStory:
|
||||||
privacy_rules = None
|
privacy_rules = None
|
||||||
|
|
||||||
if privacy:
|
if privacy:
|
||||||
privacy_rules = [types.StoriesPrivacy(type=privacy)]
|
privacy_rules = [types.StoriesPrivacyRules(type=privacy)]
|
||||||
|
|
||||||
if animation:
|
if animation:
|
||||||
if isinstance(animation, str):
|
if isinstance(animation, str):
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class SendStory:
|
||||||
async def send_story(
|
async def send_story(
|
||||||
self: "pyrogram.Client",
|
self: "pyrogram.Client",
|
||||||
channel_id: int = None,
|
channel_id: int = None,
|
||||||
privacy: "enums.StoriesPrivacy" = None,
|
privacy: "enums.StoriesPrivacyRules" = None,
|
||||||
allowed_users: List[int] = None,
|
allowed_users: List[int] = None,
|
||||||
denied_users: List[int] = None,
|
denied_users: List[int] = None,
|
||||||
allowed_chats: 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 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.
|
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.
|
Story privacy.
|
||||||
Defaults to :obj:`~pyrogram.enums.StoriesPrivacy.PUBLIC`
|
Defaults to :obj:`~pyrogram.enums.StoriesPrivacyRules.PUBLIC`
|
||||||
|
|
||||||
allowed_chats (List of ``int``, *optional*):
|
allowed_chats (List of ``int``, *optional*):
|
||||||
List of chat_id which participant allowed to view the story.
|
List of chat_id which participant allowed to view the story.
|
||||||
|
|
@ -136,9 +136,9 @@ class SendStory:
|
||||||
peer = await self.resolve_peer("me")
|
peer = await self.resolve_peer("me")
|
||||||
|
|
||||||
if privacy:
|
if privacy:
|
||||||
privacy_rules = [types.StoriesPrivacy(type=privacy)]
|
privacy_rules = [types.StoriesPrivacyRules(type=privacy)]
|
||||||
else:
|
else:
|
||||||
privacy_rules = [types.StoriesPrivacy(type=enums.StoriesPrivacy.PUBLIC)]
|
privacy_rules = [types.StoriesPrivacyRules(type=enums.StoriesPrivacyRules.PUBLIC)]
|
||||||
|
|
||||||
if animation:
|
if animation:
|
||||||
if isinstance(animation, str):
|
if isinstance(animation, str):
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ from .poll_option import PollOption
|
||||||
from .reaction import Reaction
|
from .reaction import Reaction
|
||||||
from .sticker import Sticker
|
from .sticker import Sticker
|
||||||
from .stickerset import StickerSet
|
from .stickerset import StickerSet
|
||||||
from .stories_privacy import StoriesPrivacy
|
from .stories_privacy_rules import StoriesPrivacyRules
|
||||||
from .stripped_thumbnail import StrippedThumbnail
|
from .stripped_thumbnail import StrippedThumbnail
|
||||||
from .thumbnail import Thumbnail
|
from .thumbnail import Thumbnail
|
||||||
from .venue import Venue
|
from .venue import Venue
|
||||||
|
|
@ -51,5 +51,5 @@ from .exported_story_link import ExportedStoryLink
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Photo", "Thumbnail",
|
"Animation", "Audio", "Contact", "Document", "Game", "Location", "Message", "MessageEntity", "Photo", "Thumbnail",
|
||||||
"StrippedThumbnail", "Poll", "PollOption", "Sticker", "StickerSet", "Venue", "Video", "VideoNote", "Voice", "WebPage", "Dice",
|
"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 pyrogram import enums, raw
|
||||||
from ..object import Object
|
from ..object import Object
|
||||||
|
|
||||||
class StoriesPrivacy(Object):
|
class StoriesPrivacyRules(Object):
|
||||||
"""A story privacy.
|
"""A story privacy.
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
type (:obj:`~pyrogram.enums.StoriesPrivacy`):
|
type (:obj:`~pyrogram.enums.StoriesPrivacyRules`):
|
||||||
Story privacy type.
|
Story privacy type.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, *,
|
self, *,
|
||||||
type: "enums.StoriesPrivacy"
|
type: "enums.StoriesPrivacyRules"
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.type = type
|
self.type = type
|
||||||
|
|
||||||
def write(self):
|
def write(self):
|
||||||
if self.type == enums.StoriesPrivacy.PUBLIC:
|
if self.type == enums.StoriesPrivacyRules.PUBLIC:
|
||||||
return raw.types.InputPrivacyValueAllowAll().write()
|
return raw.types.InputPrivacyValueAllowAll().write()
|
||||||
if self.type == enums.StoriesPrivacy.CLOSE_FRIENDS:
|
if self.type == enums.StoriesPrivacyRules.CLOSE_FRIENDS:
|
||||||
return raw.types.InputPrivacyValueAllowCloseFriends().write()
|
return raw.types.InputPrivacyValueAllowCloseFriends().write()
|
||||||
if self.type == enums.StoriesPrivacy.CONTACTS:
|
if self.type == enums.StoriesPrivacyRules.CONTACTS:
|
||||||
return raw.types.InputPrivacyValueAllowContacts().write()
|
return raw.types.InputPrivacyValueAllowContacts().write()
|
||||||
if self.type == enums.StoriesPrivacy.NO_CONTACTS:
|
if self.type == enums.StoriesPrivacyRules.NO_CONTACTS:
|
||||||
return raw.types.InputPrivacyValueDisallowContacts().write()
|
return raw.types.InputPrivacyValueDisallowContacts().write()
|
||||||
if self.type == enums.StoriesPrivacy.PRIVATE:
|
if self.type == enums.StoriesPrivacyRules.PRIVATE:
|
||||||
return raw.types.InputPrivacyValueDisallowAll().write()
|
return raw.types.InputPrivacyValueDisallowAll().write()
|
||||||
|
|
@ -1364,7 +1364,7 @@ class Story(Object, Update):
|
||||||
|
|
||||||
async def edit(
|
async def edit(
|
||||||
self,
|
self,
|
||||||
privacy: "enums.StoriesPrivacy" = None,
|
privacy: "enums.StoriesPrivacyRules" = None,
|
||||||
allowed_users: List[int] = None,
|
allowed_users: List[int] = None,
|
||||||
denied_users: List[int] = None,
|
denied_users: List[int] = None,
|
||||||
allowed_chats: 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
|
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.
|
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.
|
Story privacy.
|
||||||
|
|
||||||
allowed_chats (List of ``int``, *optional*):
|
allowed_chats (List of ``int``, *optional*):
|
||||||
|
|
@ -1548,7 +1548,7 @@ class Story(Object, Update):
|
||||||
|
|
||||||
async def edit_privacy(
|
async def edit_privacy(
|
||||||
self,
|
self,
|
||||||
privacy: "enums.StoriesPrivacy" = None,
|
privacy: "enums.StoriesPrivacyRules" = None,
|
||||||
allowed_users: List[int] = None,
|
allowed_users: List[int] = None,
|
||||||
denied_users: List[int] = None,
|
denied_users: List[int] = None,
|
||||||
allowed_chats: List[int] = None,
|
allowed_chats: List[int] = None,
|
||||||
|
|
@ -1562,16 +1562,16 @@ class Story(Object, Update):
|
||||||
|
|
||||||
await client.edit_story(
|
await client.edit_story(
|
||||||
story_id=story.id,
|
story_id=story.id,
|
||||||
privacy=enums.StoriesPrivacy.PUBLIC
|
privacy=enums.StoriesPrivacyRules.PUBLIC
|
||||||
)
|
)
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
await story.edit_privacy(enums.StoriesPrivacy.PUBLIC)
|
await story.edit_privacy(enums.StoriesPrivacyRules.PUBLIC)
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
privacy (:obj:`~pyrogram.enums.StoriesPrivacy`, *optional*):
|
privacy (:obj:`~pyrogram.enums.StoriesPrivacyRules`, *optional*):
|
||||||
Story privacy.
|
Story privacy.
|
||||||
|
|
||||||
allowed_chats (List of ``int``, *optional*):
|
allowed_chats (List of ``int``, *optional*):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue