ptbtest.chatgenerator module

This module provides a class to generate telegram chats

class ptbtest.chatgenerator.ChatGenerator

Bases: ptbtest.ptbgenerator.PtbGenerator

Chat generator class. placeholder for random names and mainly used via it’s get_chat() method

get_chat(cid=None, type='private', title=None, username=None, user=None, all_members_are_administrators=False)

Returns a telegram.Chat object with the optionally given type or username If any of the arguments are omitted the names will be chosen randomly and the username will be generated as first_name + last_name.

When called without arguments will return a telegram.Chat object for a private chat with a randomly generated user.

Parameters:
  • type (str) – Type of chat can be private, group, supergroup or channel.
  • title (Optional[str]) – Title for the group/supergroup/channel/
  • username (Optional[str]) – Username for the private/supergroup/channel.
  • user (Optional[telegram.User]) – If given a private chat for the supplied user will be generated.
  • all_members_are_administrators – set’s this flag for a group.
Returns:

A telegram Chat object.

Return type:

telegram.Chat