mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-27 16:45:19 +00:00
Add hide_stories method
This commit is contained in:
parent
db54c77cf3
commit
3c57bda622
@ -22,12 +22,13 @@ from .edit_story import EditStory
|
||||
from .export_story_link import ExportStoryLink
|
||||
from .get_all_stories import GetAllStories
|
||||
from .get_peer_stories import GetPeerStories
|
||||
from .get_stories_archive import GetStoriesArchive
|
||||
from .get_stories import GetStories
|
||||
from .get_stories_archive import GetStoriesArchive
|
||||
from .hide_stories import HideStories
|
||||
from .increment_story_views import IncrementStoryViews
|
||||
from .pin_stories import PinStories
|
||||
from .read_stories import ReadStories
|
||||
from .send_story import SendStory
|
||||
from .toggle_stories_pinned import ToggleStoriesPinned
|
||||
|
||||
class Stories(
|
||||
ApplyBoost,
|
||||
@ -38,9 +39,10 @@ class Stories(
|
||||
GetPeerStories,
|
||||
GetStories,
|
||||
GetStoriesArchive,
|
||||
HideStories,
|
||||
IncrementStoryViews,
|
||||
PinStories,
|
||||
ReadStories,
|
||||
SendStory,
|
||||
ToggleStoriesPinned
|
||||
):
|
||||
pass
|
||||
|
57
pyrogram/methods/stories/hide_stories.py
Normal file
57
pyrogram/methods/stories/hide_stories.py
Normal file
@ -0,0 +1,57 @@
|
||||
# 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 typing import Union
|
||||
|
||||
import pyrogram
|
||||
from pyrogram import raw
|
||||
|
||||
|
||||
class HideStories:
|
||||
async def hide_stories(
|
||||
self: "pyrogram.Client",
|
||||
chat_id: Union[int, str],
|
||||
hidden: bool = None
|
||||
) -> bool:
|
||||
"""Toggle peer stories hidden
|
||||
|
||||
.. include:: /_includes/usable-by/users-bots.rst
|
||||
|
||||
Parameters:
|
||||
chat_id (``int`` | ``str``):
|
||||
Unique identifier (int) or username (str) of the target chat.
|
||||
For your personal cloud (Saved Messages) you can simply use "me" or "self".
|
||||
For a contact that exists in your Telegram address book you can use his phone number (str).
|
||||
|
||||
Returns:
|
||||
``str``: On success, a bool is returned.
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
|
||||
# Export a story link
|
||||
link = app.hide_stories("me")
|
||||
"""
|
||||
r = await self.invoke(
|
||||
raw.functions.stories.TogglePeerStoriesHidden(
|
||||
peer=await self.resolve_peer(chat_id),
|
||||
hidden=hidden
|
||||
)
|
||||
)
|
||||
|
||||
return r
|
Loading…
Reference in New Issue
Block a user