mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
Pyrofork: Add StoriesPrivacy
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
983d39c092
commit
acd70f7f2e
5 changed files with 93 additions and 2 deletions
|
|
@ -459,6 +459,7 @@ def pyrogram_api():
|
|||
stories="""
|
||||
Stories
|
||||
Story
|
||||
StoriesPrivacy
|
||||
StoryViews
|
||||
""",
|
||||
bot_keyboards="""
|
||||
|
|
|
|||
|
|
@ -29,6 +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 .user_status import UserStatus
|
||||
|
||||
__all__ = [
|
||||
|
|
@ -44,6 +45,7 @@ __all__ = [
|
|||
'NextCodeType',
|
||||
'ParseMode',
|
||||
'PollType',
|
||||
'SentCodeType',
|
||||
'SentCodeType',
|
||||
"StoriesPrivacy",
|
||||
'UserStatus'
|
||||
]
|
||||
|
|
|
|||
40
pyrogram/enums/stories_privacy.py
Normal file
40
pyrogram/enums/stories_privacy.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# Pyrofork - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# This file is part of Pyrofork.
|
||||
#
|
||||
# Pyrofork 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.
|
||||
#
|
||||
# Pyrofork 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 Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from enum import auto
|
||||
|
||||
from .auto_name import AutoName
|
||||
|
||||
|
||||
class StoriesPrivacy(AutoName):
|
||||
"""Poll type enumeration used in :obj:`~pyrogram.types.Stories`."""
|
||||
|
||||
PUBLIC = auto()
|
||||
"Public stories"
|
||||
|
||||
CLOSE_FRIENDS = auto()
|
||||
"Close_Friends stories"
|
||||
|
||||
CONTACTS = auto()
|
||||
"Contacts only stories"
|
||||
|
||||
PRIVATE = auto()
|
||||
"Private stories"
|
||||
|
||||
NO_CONTACTS = auto()
|
||||
"Hide stories from contacts"
|
||||
|
|
@ -31,6 +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 .stripped_thumbnail import StrippedThumbnail
|
||||
from .thumbnail import Thumbnail
|
||||
from .venue import Venue
|
||||
|
|
@ -46,5 +47,5 @@ from .story_views import StoryViews
|
|||
__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", "Story", "StoryViews"
|
||||
"Reaction", "WebAppData", "MessageReactions", "Story", "StoryViews", "StoriesPrivacy"
|
||||
]
|
||||
|
|
|
|||
47
pyrogram/types/messages_and_media/stories_privacy.py
Normal file
47
pyrogram/types/messages_and_media/stories_privacy.py
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# Pyrofork - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2022-present Mayuri-Chan <https://github.com/Mayuri-Chan>
|
||||
#
|
||||
# This file is part of Pyrofork.
|
||||
#
|
||||
# Pyrofork 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.
|
||||
#
|
||||
# Pyrofork 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 Pyrofork. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from pyrogram import enums, raw
|
||||
from ..object import Object
|
||||
|
||||
class StoriesPrivacy(Object):
|
||||
"""A story privacy.
|
||||
|
||||
Parameters:
|
||||
type (:obj:`~pyrogram.enums.StoriesPrivary`):
|
||||
Story privacy type.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, *,
|
||||
type: "enums.StoriesPrivacy"
|
||||
):
|
||||
super().__init__()
|
||||
self.type = type
|
||||
|
||||
def write(self):
|
||||
if self.type == enums.StoriesPrivacy.PUBLIC:
|
||||
return raw.types.InputPrivacyValueAllowAll().write()
|
||||
if self.type == enums.StoriesPrivacy.CLOSE_FRIENDS:
|
||||
return raw.types.InputPrivacyValueAllowCloseFriends().write()
|
||||
if self.type == enums.StoriesPrivacy.CONTACTS:
|
||||
return raw.types.InputPrivacyValueAllowContacts().write()
|
||||
if self.type == enums.StoriesPrivacy.NO_CONTACTS:
|
||||
return raw.types.InputPrivacyValueDisallowContacts().write()
|
||||
if self.type == enums.StoriesPrivacy.PRIVATE:
|
||||
return raw.types.InputPrivacyValueDisallowAll().write()
|
||||
Loading…
Reference in a new issue