Search
---functions--- messages.search#29ee847a peer:InputPeer q:string from_id:flags.0?InputPeer saved_peer_id:flags.2?InputPeer saved_reaction:flags.3?Vector<Reaction> top_msg_id:flags.1?int filter:MessagesFilter min_date:int max_date:int offset_id:int add_offset:int limit:int max_id:int min_id:int hash:long = messages.Messages
Returns
| messages.Messages |
Parameters
| peer | InputPeer | required |
| q | string | required |
| from_id | InputPeer | optional |
| saved_peer_id | InputPeer | optional |
| saved_reaction | Vector<Reaction> | optional |
| top_msg_id | int | optional |
| filter | MessagesFilter | required |
| min_date | int | required |
| max_date | int | required |
| offset_id | int | required |
| add_offset | int | required |
| limit | int | required |
| max_id | int | required |
| min_id | int | required |
| hash | long | required |
Example
The examples below use placeholder values. Replace them with real data before running the code.
▶ Minimal
import asyncio
from ferogram import Client, raw
app = Client("my_session", api_id=12345, api_hash="0123456789abcdef0123456789abcdef")
async def main():
await app.start()
result = await app.raw.messages.Search(
peer='username',
q='some string here',
filter=raw.types.InputMessagesFilterEmpty(),
min_date=42,
max_date=42,
offset_id=42,
add_offset=0,
limit=100,
max_id=0,
min_id=0,
hash=0
)
print(result)
asyncio.run(main())
The minimal example uses Ferogram's raw proxy shorthand. Peers can be passed as strings and required primitives get safe defaults. Expand Full API to see every parameter.
▶ Full API
import asyncio
from ferogram import Client, raw
app = Client("my_session", api_id=12345, api_hash="0123456789abcdef0123456789abcdef")
async def main():
await app.start()
result = await app(raw.functions.messages.Search(
peer=raw.types.InputPeerSelf(),
q='some string here',
from_id=raw.types.InputPeerSelf(),
saved_peer_id=raw.types.InputPeerSelf(),
saved_reaction=[raw.types.ReactionEmpty()],
top_msg_id=42,
filter=raw.types.InputMessagesFilterEmpty(),
min_date=42,
max_date=42,
offset_id=42,
add_offset=0,
limit=100,
max_id=0,
min_id=0,
hash=0
))
print(result)
asyncio.run(main())