From 350265aaae4cdcbfa392b33ede86785975342ba6 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 15 Oct 2018 14:29:58 +0200 Subject: [PATCH] Add answer_inline_query method --- .../methods/bots/answer_inline_query.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 pyrogram/client/methods/bots/answer_inline_query.py diff --git a/pyrogram/client/methods/bots/answer_inline_query.py b/pyrogram/client/methods/bots/answer_inline_query.py new file mode 100644 index 00000000..07eb594d --- /dev/null +++ b/pyrogram/client/methods/bots/answer_inline_query.py @@ -0,0 +1,46 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-2018 Dan Tès +# +# This file is part of Pyrogram. +# +# Pyrogram is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pyrogram is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Pyrogram. If not, see . + +from pyrogram.api import functions, types +from pyrogram.client.ext import BaseClient + + +class AnswerInlineQuery(BaseClient): + def answer_inline_query(self, + inline_query_id: str, + results: list, + cache_time: int = 300, + is_personal: bool = None, + next_offset: str = "", + switch_pm_text: str = "", + switch_pm_parameter: str = ""): + # TODO: Docs + return self.send( + functions.messages.SetInlineBotResults( + query_id=int(inline_query_id), + results=[r.write() for r in results], + cache_time=cache_time, + gallery=None, + private=is_personal or None, + next_offset=next_offset or None, + switch_pm=types.InlineBotSwitchPM( + switch_pm_text, + switch_pm_parameter + ) if switch_pm_text else None + ) + )