mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 13:27:47 +00:00
Split location parameter into lat and long
This commit is contained in:
parent
5be87a0dec
commit
63b4f909df
@ -26,7 +26,8 @@ class GetInlineBotResults(BaseClient):
|
|||||||
bot: int or str,
|
bot: int or str,
|
||||||
query: str,
|
query: str,
|
||||||
offset: str = "",
|
offset: str = "",
|
||||||
location: tuple = None):
|
latitude: float = None,
|
||||||
|
longitude: float = None):
|
||||||
"""Use this method to get bot results via inline queries.
|
"""Use this method to get bot results via inline queries.
|
||||||
You can then send a result using :obj:`send_inline_bot_result <pyrogram.Client.send_inline_bot_result>`
|
You can then send a result using :obj:`send_inline_bot_result <pyrogram.Client.send_inline_bot_result>`
|
||||||
|
|
||||||
@ -38,11 +39,15 @@ class GetInlineBotResults(BaseClient):
|
|||||||
query (``str``):
|
query (``str``):
|
||||||
Text of the query (up to 512 characters).
|
Text of the query (up to 512 characters).
|
||||||
|
|
||||||
offset (``str``):
|
offset (``str``, *optional*):
|
||||||
Offset of the results to be returned.
|
Offset of the results to be returned.
|
||||||
|
|
||||||
location (``tuple``, *optional*):
|
latitude (``float``, *optional*):
|
||||||
Your location in tuple format (latitude, longitude), e.g.: (51.500729, -0.124583).
|
Latitude of the location.
|
||||||
|
Useful for location-based results only.
|
||||||
|
|
||||||
|
longitude (``float``, *optional*):
|
||||||
|
Longitude of the location.
|
||||||
Useful for location-based results only.
|
Useful for location-based results only.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -52,7 +57,7 @@ class GetInlineBotResults(BaseClient):
|
|||||||
:class:`Error <pyrogram.Error>`
|
:class:`Error <pyrogram.Error>`
|
||||||
``TimeoutError``: If the bot fails to answer within 10 seconds
|
``TimeoutError``: If the bot fails to answer within 10 seconds
|
||||||
"""
|
"""
|
||||||
# TODO: Split location parameter into lat and long
|
# TODO: Don't return the raw type
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return self.send(
|
return self.send(
|
||||||
@ -62,9 +67,9 @@ class GetInlineBotResults(BaseClient):
|
|||||||
query=query,
|
query=query,
|
||||||
offset=offset,
|
offset=offset,
|
||||||
geo_point=types.InputGeoPoint(
|
geo_point=types.InputGeoPoint(
|
||||||
lat=location[0],
|
lat=latitude,
|
||||||
long=location[1]
|
long=longitude
|
||||||
) if location else None
|
) if (latitude is not None and longitude is not None) else None
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except UnknownError as e:
|
except UnknownError as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user