Rename increment_story_views to view_stories

This commit is contained in:
KurimuzonAkuma 2024-05-15 21:08:58 +03:00
parent cc4aa8a2d3
commit cdcd805cb5
4 changed files with 29 additions and 6 deletions

View File

@ -388,7 +388,7 @@ def pyrogram_api():
get_stories_archive get_stories_archive
get_stories get_stories
hide_stories hide_stories
increment_story_views view_stories
pin_stories pin_stories
read_stories read_stories
send_story send_story
@ -725,6 +725,7 @@ def pyrogram_api():
Story.forward Story.forward
Story.download Story.download
Story.read Story.read
Story.view
""", """,
folder=""" folder="""
Folder Folder

View File

@ -29,7 +29,7 @@ from .get_pinned_stories import GetPinnedStories
from .get_stories import GetStories from .get_stories import GetStories
from .get_stories_archive import GetStoriesArchive from .get_stories_archive import GetStoriesArchive
from .hide_stories import HideStories from .hide_stories import HideStories
from .increment_story_views import IncrementStoryViews from .view_stories import ViewStories
from .pin_stories import PinStories from .pin_stories import PinStories
from .read_stories import ReadStories from .read_stories import ReadStories
from .send_story import SendStory from .send_story import SendStory
@ -48,7 +48,7 @@ class Stories(
GetStories, GetStories,
GetStoriesArchive, GetStoriesArchive,
HideStories, HideStories,
IncrementStoryViews, ViewStories,
PinStories, PinStories,
ReadStories, ReadStories,
SendStory, SendStory,

View File

@ -22,8 +22,8 @@ import pyrogram
from pyrogram import raw from pyrogram import raw
class IncrementStoryViews: class ViewStories:
async def increment_story_views( async def view_stories(
self: "pyrogram.Client", self: "pyrogram.Client",
chat_id: Union[int, str], chat_id: Union[int, str],
story_id: Union[int, List[int]], story_id: Union[int, List[int]],
@ -47,7 +47,7 @@ class IncrementStoryViews:
.. code-block:: python .. code-block:: python
# Increment story views # Increment story views
await app.increment_story_views(chat_id, 1) await app.view_stories(chat_id, 1)
""" """
ids = [story_id] if not isinstance(story_id, list) else story_id ids = [story_id] if not isinstance(story_id, list) else story_id

View File

@ -1835,3 +1835,25 @@ class Story(Object, Update):
chat_id=self.chat.id, chat_id=self.chat.id,
max_id=self.id max_id=self.id
) )
async def view(self) -> List[int]:
"""Bound method *view* of :obj:`~pyrogram.types.Story`.
Example:
.. code-block:: python
await story.view()
Returns:
True on success, False otherwise.
Example:
.. code-block:: python
# Read stories
await app.view_stories(chat_id)
"""
return await self._client.view_stories(
chat_id=self.chat.id,
story_id=self.id
)