Skip to content

Commit 4205e46

Browse files
committed
Fix missing location object in InlineQuery.
1 parent 2044fba commit 4205e46

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

telebot/types.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,23 +754,28 @@ def de_json(cls, json_type):
754754
obj = cls.check_json(json_type)
755755
id = obj['id']
756756
from_user = User.de_json(obj['from'])
757+
location = None
758+
if 'location' in obj:
759+
location = Location.de_json(obj['location'])
757760
query = obj['query']
758761
offset = obj['offset']
759-
return cls(id, from_user, query, offset)
762+
return cls(id, from_user, location, query, offset)
760763

761-
def __init__(self, id, from_user, query, offset):
764+
def __init__(self, id, from_user, location, query, offset):
762765
"""
763766
This object represents an incoming inline query.
764767
When the user sends an empty query, your bot could
765768
return some default or trending results.
766769
:param id: string Unique identifier for this query
767770
:param from_user: User Sender
771+
:param location: Sender location, only for bots that request user location
768772
:param query: String Text of the query
769773
:param offset: String Offset of the results to be returned, can be controlled by the bot
770774
:return: InlineQuery Object
771775
"""
772776
self.id = id
773777
self.from_user = from_user
778+
self.location = location
774779
self.query = query
775780
self.offset = offset
776781

0 commit comments

Comments
 (0)