From 4205e46608d6144a56b4d215df182eb2e59e77b1 Mon Sep 17 00:00:00 2001 From: eternnoir Date: Wed, 6 Jul 2016 10:13:42 +0800 Subject: [PATCH] Fix missing location object in InlineQuery. --- telebot/types.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index abc5cfa..f8f4434 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -754,23 +754,28 @@ class InlineQuery(JsonDeserializable): obj = cls.check_json(json_type) id = obj['id'] from_user = User.de_json(obj['from']) + location = None + if 'location' in obj: + location = Location.de_json(obj['location']) query = obj['query'] offset = obj['offset'] - return cls(id, from_user, query, offset) + return cls(id, from_user, location, query, offset) - def __init__(self, id, from_user, query, offset): + def __init__(self, id, from_user, location, query, offset): """ This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results. :param id: string Unique identifier for this query :param from_user: User Sender + :param location: Sender location, only for bots that request user location :param query: String Text of the query :param offset: String Offset of the results to be returned, can be controlled by the bot :return: InlineQuery Object """ self.id = id self.from_user = from_user + self.location = location self.query = query self.offset = offset