Add InlineQuery type

This commit is contained in:
Dan 2018-10-15 10:48:07 +02:00
parent 474388d8a4
commit a9fe0fffc6
4 changed files with 62 additions and 2 deletions

View File

@ -31,7 +31,8 @@ from .client.types import (
InputMediaVideo, InputMediaDocument, InputMediaAudio, InputMediaAnimation, InputPhoneContact, InputMediaVideo, InputMediaDocument, InputMediaAudio, InputMediaAnimation, InputPhoneContact,
Location, Message, MessageEntity, Dialog, Dialogs, Photo, PhotoSize, Sticker, Update, User, Location, Message, MessageEntity, Dialog, Dialogs, Photo, PhotoSize, Sticker, Update, User,
UserProfilePhotos, Venue, Animation, Video, VideoNote, Voice, CallbackQuery, Messages, ForceReply, UserProfilePhotos, Venue, Animation, Video, VideoNote, Voice, CallbackQuery, Messages, ForceReply,
InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove,
InlineQuery
) )
from .client import ( from .client import (
Client, ChatAction, ParseMode, Emoji, Client, ChatAction, ParseMode, Emoji,

View File

@ -18,7 +18,7 @@
from .bots import ( from .bots import (
CallbackQuery, ForceReply, InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery, ForceReply, InlineKeyboardButton, InlineKeyboardMarkup,
KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove, InlineQuery
) )
from .bots import ( from .bots import (
ForceReply, InlineKeyboardButton, InlineKeyboardMarkup, ForceReply, InlineKeyboardButton, InlineKeyboardMarkup,

View File

@ -20,6 +20,7 @@ from .callback_query import CallbackQuery
from .force_reply import ForceReply from .force_reply import ForceReply
from .inline_keyboard_button import InlineKeyboardButton from .inline_keyboard_button import InlineKeyboardButton
from .inline_keyboard_markup import InlineKeyboardMarkup from .inline_keyboard_markup import InlineKeyboardMarkup
from .inline_query import InlineQuery
from .keyboard_button import KeyboardButton from .keyboard_button import KeyboardButton
from .reply_keyboard_markup import ReplyKeyboardMarkup from .reply_keyboard_markup import ReplyKeyboardMarkup
from .reply_keyboard_remove import ReplyKeyboardRemove from .reply_keyboard_remove import ReplyKeyboardRemove

View File

@ -0,0 +1,58 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# 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 <http://www.gnu.org/licenses/>.
from pyrogram.api.core import Object
class InlineQuery(Object):
"""This object represents an incoming inline query.
When the user sends an empty query, your bot could return some default or trending results
Args:
id (``str``):
Unique identifier for this query.
from_user (:obj:`User <pyrogram.User>`):
Sender.
query (``str``):
Text of the query (up to 512 characters).
offset (``str``):
Offset of the results to be returned, can be controlled by the bot.
location (:obj:`Location <pyrogram.Location>`. *optional*):
Sender location, only for bots that request user location.
"""
ID = 0xb0700024
def __init__(
self,
client,
id: str,
from_user,
query: str,
offset: str,
location=None,
):
self._client = client
self.id = id
self.from_user = from_user
self.query = query
self.offset = offset
self.location = location