usergenerator.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:ptbtest 作者: Eldinnie 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号