def get_user(self, 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.
Args:
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:
telegram.User: A telegram user object
"""
if not first_name:
first_name = random.choice(self.FIRST_NAMES)
if not last_name:
last_name = random.choice(self.LAST_NAMES)
if not username:
username = first_name + last_name
return User(
id or self.gen_id(),
first_name,
last_name=last_name,
username=username)
评论列表
文章目录