ptbtest.callbackquerygenerator module

This module provides a class to generate telegram callback queries

class ptbtest.callbackquerygenerator.CallbackQueryGenerator(bot=None)

Bases: ptbtest.ptbgenerator.PtbGenerator

Callback query generator class.

bot

ptbtest.Mockbot – Bot to encode with the messages

Parameters:bot (Optional[ptbtest.Mockbot]) – supply your own for a custom botname
get_callback_query(*args, **kwargs)

Returns a telegram.Update object containing a callback_query.

Notes

One of message and inline_message_id must be present One of data and game_short_name must be present

Parameters:
  • user (Optional[telegram.User]) – User that initiated the callback_query
  • chat_instance (Optional[str]) – unique identifier, not used
  • message (Optional[telegram.Message]) – Message the callback_query button belongs to
  • inline_message_id (Optional[str]) – Message the callback_query button belongs to
  • data (Optional[string]) – Data attached to the button
  • game_short_name (Optional[str]) – game identifier with this button
Returns:

containing a telegram.CallbackQuery

Return type:

telegram.Update