ptbtest.inlinequerygenerator module

This module provides a class to generate telegram callback queries

class ptbtest.inlinequerygenerator.InlineQueryGenerator(bot=None)

Bases: PtbGenerator

Callback query generator class.

bot

Bot to encode with the messages

Type

ptbtest.Mockbot

Parameters

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

get_chosen_inline_result(result_id=None, query=None, user=None, location=None, inline_message_id=None)

Returns a telegram.Update object containing a inline_query.

Parameters
  • result_id (str) – The result_id belonging to this chosen result

  • inline_message_id (Optional[str]) – Of omitted will be generated

  • location (Optional[telegram.Location or True]) – simulates a location

  • query (Optional[str]) – The query used to send this query

  • user (Optional[telegram.User) – If omitted will be randomly generated

Returns

an update containing a telegram.ChosenInlineResult

Return type

telegram.Update

get_inline_query(user=None, query=None, offset=None, location=None)

Returns a telegram.Update object containing a inline_query.

Parameters
  • user (Optional[telegram.User) – If omitted, will be randomly generated

  • query (Optional[str]) – The query string to be used

  • offset (Optional[str]) – Offset of the results to be returned

  • location (Optional[telegram.Location or True]) – simulates a location

Returns

an update containing a telegram.InlineQuery

Return type

telegram.Update