Rename increment_message_views method to view_messages

This commit is contained in:
KurimuzonAkuma 2024-05-11 16:10:32 +03:00
parent d2b710da9a
commit 06f689ebdb
4 changed files with 9 additions and 9 deletions

View File

@ -178,12 +178,12 @@ def pyrogram_api():
get_messages get_messages
get_scheduled_messages get_scheduled_messages
get_stickers get_stickers
increment_message_views
get_media_group get_media_group
get_chat_history get_chat_history
get_chat_history_count get_chat_history_count
read_chat_history read_chat_history
send_poll send_poll
view_messages
vote_poll vote_poll
stop_poll stop_poll
retract_vote retract_vote

View File

@ -39,7 +39,6 @@ from .get_media_group import GetMediaGroup
from .get_messages import GetMessages from .get_messages import GetMessages
from .get_scheduled_messages import GetScheduledMessages from .get_scheduled_messages import GetScheduledMessages
from .get_stickers import GetStickers from .get_stickers import GetStickers
from .increment_message_views import IncrementMessageViews
from .read_chat_history import ReadChatHistory from .read_chat_history import ReadChatHistory
from .read_mentions import ReadMentions from .read_mentions import ReadMentions
from .read_reactions import ReadReactions from .read_reactions import ReadReactions
@ -70,6 +69,7 @@ from .send_web_page import SendWebPage
from .start_bot import StartBot from .start_bot import StartBot
from .stop_poll import StopPoll from .stop_poll import StopPoll
from .stream_media import StreamMedia from .stream_media import StreamMedia
from .view_messages import ViewMessages
from .vote_poll import VotePoll from .vote_poll import VotePoll
@ -100,6 +100,7 @@ class Messages(
SendVoice, SendVoice,
SendPoll, SendPoll,
SendWebPage, SendWebPage,
ViewMessages,
VotePoll, VotePoll,
StartBot, StartBot,
StopPoll, StopPoll,
@ -108,7 +109,6 @@ class Messages(
GetChatHistory, GetChatHistory,
SendCachedMedia, SendCachedMedia,
GetChatHistoryCount, GetChatHistoryCount,
IncrementMessageViews,
ReadChatHistory, ReadChatHistory,
ReadMentions, ReadMentions,
ReadReactions, ReadReactions,

View File

@ -22,13 +22,13 @@ import pyrogram
from pyrogram import raw from pyrogram import raw
class IncrementMessageViews: class ViewMessages:
async def increment_message_views( async def view_messages(
self: "pyrogram.Client", self: "pyrogram.Client",
chat_id: Union[int, str], chat_id: Union[int, str],
message_id: Union[int, List[int]], message_id: Union[int, List[int]],
) -> bool: ) -> bool:
"""Increment message views. """Increment message views counter.
.. include:: /_includes/usable-by/users.rst .. include:: /_includes/usable-by/users.rst
@ -46,7 +46,7 @@ class IncrementMessageViews:
.. code-block:: python .. code-block:: python
# Increment message views # Increment message views
await app.increment_message_views(chat_id, 1) await app.view_messages(chat_id, 1)
""" """
ids = [message_id] if not isinstance(message_id, list) else message_id ids = [message_id] if not isinstance(message_id, list) else message_id

View File

@ -4700,7 +4700,7 @@ class Message(Object, Update):
.. code-block:: python .. code-block:: python
await client.increment_message_views( await client.view_messages(
chat_id=message.chat.id, chat_id=message.chat.id,
message_id=message_id message_id=message_id
) )
@ -4716,7 +4716,7 @@ class Message(Object, Update):
Raises: Raises:
RPCError: In case of a Telegram RPC error. RPCError: In case of a Telegram RPC error.
""" """
return await self._client.increment_message_views( return await self._client.view_messages(
chat_id=self.chat.id, chat_id=self.chat.id,
message_id=self.id message_id=self.id
) )