Skip to content

Commit 48152df

Browse files
committed
Rename hashtag methods
search_public_messages_by_tag count_public_messages_by_tag
1 parent f63b0c8 commit 48152df

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

compiler/docs/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ def get_title_list(s: str) -> list:
311311
search_global_count
312312
search_messages
313313
search_messages_count
314-
search_public_hashtag_messages
315-
search_public_hashtag_messages_count
314+
search_public_messages_by_tag
315+
count_public_messages_by_tag
316316
send_animation
317317
send_audio
318318
send_cached_media

docs/source/releases/changes-in-this-fork.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ If you found any issue or have any suggestions, feel free to make `an issue <htt
4242
- Added the ``successful_payment`` parameter to the :obj:`~pyrogram.types.Message`. Added the filter :obj:`~pyrogram.filters.successful_payment` to detect service messages of Successful Payment type.
4343
- Added the methods :meth:`~pyrogram.Client.send_invoice`, :meth:`~pyrogram.Client.answer_pre_checkout_query` (:meth:`~pyrogram.types.PreCheckoutQuery.answer`), :meth:`~pyrogram.Client.answer_shipping_query` (:meth:`~pyrogram.types.ShippingQuery.answer`), :meth:`~pyrogram.Client.refund_star_payment` and :meth:`~pyrogram.Client.create_invoice_link`.
4444
- Added the :meth:`~pyrogram.Client.send_web_app_custom_request`.
45-
- Added the :meth:`~pyrogram.Client.search_public_hashtag_messages` and :meth:`~pyrogram.Client.search_public_hashtag_messages_count`.
45+
- Added the :meth:`~pyrogram.Client.search_public_messages_by_tag` and :meth:`~pyrogram.Client.count_public_messages_by_tag`.
4646
- Added the ``fetch_replies`` parameter to :obj:`~pyrogram.Client`.
4747
- Added the :meth:`~pyrogram.Client.get_message_effects`.
4848
- Added the parameter ``message_effect_id`` to the methods :meth:`~pyrogram.Client.send_message`, :meth:`~pyrogram.Client.send_photo`, :meth:`~pyrogram.Client.send_video`, :meth:`~pyrogram.Client.send_animation`, :meth:`~pyrogram.Client.send_audio`, :meth:`~pyrogram.Client.send_document`, :meth:`~pyrogram.Client.send_sticker`, :meth:`~pyrogram.Client.send_video_note`, :meth:`~pyrogram.Client.send_voice`, :meth:`~pyrogram.Client.send_location`, :meth:`~pyrogram.Client.send_venue`, :meth:`~pyrogram.Client.send_contact`, :meth:`~pyrogram.Client.send_poll`, :meth:`~pyrogram.Client.send_dice`, :meth:`~pyrogram.Client.send_game`, and :meth:`~pyrogram.Client.send_media_group`, and the corresponding ``reply_*`` methods in the class :obj:`~pyrogram.types.Message`.

pyrogram/methods/messages/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
from .view_messages import ViewMessages
6868
from .vote_poll import VotePoll
6969
from .get_chat_sponsored_messages import GetChatSponsoredMessages
70-
from .search_public_hashtag_messages import SearchPublicHashtagMessages
71-
from .search_public_hashtag_messages_count import SearchPublicHashtagMessagesCount
70+
from .search_public_messages_by_tag import SearchPublicMessagesByTag
71+
from .count_public_messages_by_tag import CountPublicMessagesByTag
7272
from .translate_text import TranslateText
7373

7474
class Messages(
@@ -100,8 +100,8 @@ class Messages(
100100
SearchGlobalCount,
101101
SearchMessages,
102102
SearchMessagesCount,
103-
SearchPublicHashtagMessages,
104-
SearchPublicHashtagMessagesCount,
103+
SearchPublicMessagesByTag,
104+
CountPublicMessagesByTag,
105105
SendAnimation,
106106
SendAudio,
107107
SendCachedMedia,

pyrogram/methods/messages/search_public_hashtag_messages_count.py renamed to pyrogram/methods/messages/count_public_messages_by_tag.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
from pyrogram import raw
2121

2222

23-
class SearchPublicHashtagMessagesCount:
24-
async def search_public_hashtag_messages_count(
23+
class CountPublicMessagesByTag:
24+
async def count_public_messages_by_tag(
2525
self: "pyrogram.Client",
26-
hashtag: str = "",
26+
tag: str = "",
2727
) -> int:
2828
"""Get the count of messages with the provided hashtag or cashtag.
2929
30-
If you want to get the actual messages, see :meth:`~pyrogram.Client.search_public_hashtag_messages`.
30+
If you want to get the actual messages, see :meth:`~pyrogram.Client.search_public_messages_by_tag`.
3131
3232
.. include:: /_includes/usable-by/users.rst
3333
@@ -41,7 +41,7 @@ async def search_public_hashtag_messages_count(
4141
"""
4242
r = await self.invoke(
4343
raw.functions.channels.SearchPosts(
44-
hashtag=hashtag,
44+
hashtag=tag,
4545
offset_rate=0,
4646
offset_peer=raw.types.InputPeerEmpty(),
4747
offset_id=0,

pyrogram/methods/messages/search_public_hashtag_messages.py renamed to pyrogram/methods/messages/search_public_messages_by_tag.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@
2323
from pyrogram import raw, types, utils
2424

2525

26-
class SearchPublicHashtagMessages:
27-
async def search_public_hashtag_messages(
26+
class SearchPublicMessagesByTag:
27+
async def search_public_messages_by_tag(
2828
self: "pyrogram.Client",
29-
hashtag: str = "",
29+
tag: str = "",
3030
offset_id: int = 0,
3131
offset_date: datetime = utils.zero_datetime(),
3232
limit: int = 0,
3333
) -> AsyncGenerator["types.Message", None]:
34-
"""Searches for public channel posts with the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by Telegram Server and can be smaller than the specified limit.
34+
"""Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by Telegram Server and can be smaller than the specified limit.
3535
36-
If you want to get the posts count only, see :meth:`~pyrogram.Client.search_public_hashtag_messages_count`.
36+
If you want to get the posts count only, see :meth:`~pyrogram.Client.count_public_messages_by_tag`.
3737
3838
.. include:: /_includes/usable-by/users.rst
3939
4040
Parameters:
41-
hashtag (``str``, *optional*):
41+
tag (``str``, *optional*):
4242
Hashtag or cashtag to search for.
4343
4444
offset_id (``int``, *optional*):
@@ -58,7 +58,7 @@ async def search_public_hashtag_messages(
5858
.. code-block:: python
5959
6060
# Search for "#pyrogram". Get the first 50 results
61-
async for message in app.search_public_hashtag_messages("pyrogram", limit=50):
61+
async for message in app.search_public_messages_by_tag("pyrogram", limit=50):
6262
print(message.text)
6363
6464
"""
@@ -73,7 +73,7 @@ async def search_public_hashtag_messages(
7373
self,
7474
await self.invoke(
7575
raw.functions.channels.SearchPosts(
76-
hashtag=hashtag,
76+
hashtag=tag,
7777
offset_rate=utils.datetime_to_timestamp(offset_date),
7878
offset_peer=offset_peer,
7979
offset_id=offset_id,

0 commit comments

Comments
 (0)