Fix increment_story_views

This commit is contained in:
KurimuzonAkuma 2024-02-05 23:28:17 +03:00
parent 7876906243
commit 91f3ffa431
2 changed files with 8 additions and 6 deletions

View File

@ -43,7 +43,7 @@ class VotePoll:
message_id (``int``): message_id (``int``):
Identifier of the original message with the poll. Identifier of the original message with the poll.
options (``Int`` | List of ``int``): options (``int`` | List of ``int``):
Index or list of indexes (for multiple answers) of the poll option(s) you want to vote for (0 to 9). Index or list of indexes (for multiple answers) of the poll option(s) you want to vote for (0 to 9).
Returns: Returns:

View File

@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. # along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
from typing import Union from typing import Union, List
import pyrogram import pyrogram
from pyrogram import raw from pyrogram import raw
@ -26,7 +26,7 @@ class IncrementStoryViews:
async def increment_story_views( async def increment_story_views(
self: "pyrogram.Client", self: "pyrogram.Client",
chat_id: Union[int, str], chat_id: Union[int, str],
story_id: int, story_id: Union[int, List[int]],
) -> bool: ) -> bool:
"""Increment story views. """Increment story views.
@ -37,8 +37,8 @@ class IncrementStoryViews:
Unique identifier (int) or username (str) of the target chat. Unique identifier (int) or username (str) of the target chat.
For a contact that exists in your Telegram address book you can use his phone number (str). For a contact that exists in your Telegram address book you can use his phone number (str).
story_id (``int``): story_id (``int`` | List of ``int``):
Unique identifier of the target story. Identifier or list of story identifiers of the target story.
Returns: Returns:
``bool``: On success, True is returned. ``bool``: On success, True is returned.
@ -49,10 +49,12 @@ class IncrementStoryViews:
# Increment story views # Increment story views
await app.increment_story_views(chat_id, 1) await app.increment_story_views(chat_id, 1)
""" """
ids = [story_id] if not isinstance(story_id, list) else story_id
r = await self.invoke( r = await self.invoke(
raw.functions.stories.IncrementStoryViews( raw.functions.stories.IncrementStoryViews(
peer=await self.resolve_peer(chat_id), peer=await self.resolve_peer(chat_id),
id=story_id id=ids
) )
) )