Add CallbackQuery to docs

This commit is contained in:
Dan 2018-04-29 19:06:35 +02:00
parent 4eed293933
commit d3472fd052
9 changed files with 46 additions and 6 deletions

View File

@ -0,0 +1,6 @@
CallbackQueryHandler
====================
.. autoclass:: pyrogram.CallbackQueryHandler
:members:
:undoc-members:

View File

@ -0,0 +1,9 @@
:tocdepth: 1
Handlers
========
.. toctree::
MessageHandler
CallbackQueryHandler
RawUpdateHandler

View File

@ -9,8 +9,7 @@ after the well established `Telegram Bot API`_ methods, thus offering a familiar
.. toctree::
Client
types/index
MessageHandler
RawUpdateHandler
handlers/index
Filters
ChatAction
ParseMode

View File

@ -0,0 +1,5 @@
CallbackQuery
=============
.. autoclass:: pyrogram.CallbackQuery
:members:

View File

@ -30,4 +30,5 @@ Types
reply_markup/InlineKeyboardMarkup
reply_markup/KeyboardButton
reply_markup/ReplyKeyboardMarkup
reply_markup/ReplyKeyboardRemove
reply_markup/ReplyKeyboardRemove
CallbackQuery

View File

@ -37,7 +37,7 @@ class MessageHandler(Handler):
client (:obj:`Client <pyrogram.Client>`):
The Client itself, useful when you want to call other API methods inside the message handler.
message (:obj:`Message <pyrogram.api.types.pyrogram.Message>`):
message (:obj:`Message <pyrogram.Message>`):
The received message.
"""
@ -53,6 +53,26 @@ class MessageHandler(Handler):
class CallbackQueryHandler(Handler):
"""The CallbackQuery handler class. Used to handle callback queries coming from inline buttons.
It is intended to be used with :meth:`add_handler() <pyrogram.Client.add_handler>`
Args:
callback (``callable``):
Pass a function that will be called when a new CallbackQuery arrives. It takes *(client, callback_query)*
as positional arguments (look at the section below for a detailed description).
filters (:obj:`Filters <pyrogram.Filters>`):
Pass one or more filters to allow only a subset of callback queries to be passed
in your callback function.
Other parameters:
client (:obj:`Client <pyrogram.Client>`):
The Client itself, useful when you want to call other API methods inside the message handler.
callback_query (:obj:`CallbackQuery <pyrogram.CallbackQuery>`):
The received callback query.
"""
def __init__(self, callback: callable, filters=None):
super().__init__(callback, filters)

View File

@ -32,14 +32,14 @@ class CallbackQuery(Object):
id (``str``):
Unique identifier for this query.
from_user (:obj:`User <pyrogram.types.User>`):
from_user (:obj:`User <pyrogram.User>`):
Sender.
chat_instance (``str``, optional):
Message with the callback button that originated the query. Note that message content and message date will
not be available if the message is too old.
message (:obj:`Message <pyrogram.types.Message>`, optional):
message (:obj:`Message <pyrogram.Message>`, optional):
Identifier of the message sent via the bot in inline mode, that originated the query.
inline_message_id (``str``):