Merge pull request #3 from Anatras02/master

Created a new class to handle InlineQueryResults
This commit is contained in:
PyMaster 2020-12-28 20:47:57 +03:00 committed by GitHub
commit 1ac93a4b67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -7,3 +7,5 @@ __copyright__ = 'Copyright 2020 PyMaster'
from .inline_keyboard import InlineKeyboard
from .inline_pagination_keyboard import InlinePaginationKeyboard
from .reply_keyboard import ReplyKeyboard
from .inline_query_results import InlineQueryResults

View File

@ -0,0 +1,23 @@
from pyrogram.types import InlineQueryResultArticle,InputTextMessageContent
from uuid import uuid4
class InlineQueryResults(list):
def __init__(self):
self.results = list()
super().__init__(self.results)
def add(self,title,message_text,message_parse_mode = None,message_disable_web_page_preview = None, url = None, description = None, thumb_url = None,reply_markup = None):
self.results.append(
InlineQueryResultArticle(
id = uuid4(),
title = title,
input_message_content = InputTextMessageContent(message_text=message_text,parse_mode=message_parse_mode,disable_web_page_preview=message_disable_web_page_preview),
url = url,
description = description,
thumb_url = thumb_url,
reply_markup = reply_markup
)
)
super().__init__(self.results)