ptbtest.callbackquerygenerator module

This module provides a class to generate Telegram callback queries.

class ptbtest.callbackquerygenerator.CallbackQueryGenerator(bot=None)

Bases: PtbGenerator

Callback query generator class.

bot

Bot to encode with the messages

Type

ptbtest.Mockbot

Paramaters:

bot (Optional[ptbtest.Mockbot]): supply your own for a custom botname

get_callback_query(user=None, chat_instance=None, message=None, data=None, inline_message_id=None, game_short_name=None)

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.

  • data (Optional[string]) – Data attached to the button.

  • inline_message_id (Optional[str]) – Message the callback_query button belongs to.

  • game_short_name (Optional[str]) – game identifier with this button.

Returns

containing a telegram.CallbackQuery

Return type

telegram.Update