ptbtest.usergenerator module

This module provides a class to generate telegram users

class ptbtest.usergenerator.UserGenerator

Bases: ptbtest.ptbgenerator.PtbGenerator

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

get_user(first_name=None, last_name=None, username=None, id=None)

Returns a telegram.User object with the optionally given name(s) 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.

Parameters:
  • first_name (Optional[str]) – First name for the returned user.
  • last_name (Optional[str]) – Lst name for the returned user.
  • username (Optional[str]) – Username for the returned user.
Returns:

A telegram user object

Return type:

telegram.User