From 997a3c1626c6b9d79c959feab1a0fb6a0e19fc1a Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Thu, 11 Jul 2019 00:12:27 +0200 Subject: [PATCH] Remove UserStatus (user_status.py) --- compiler/docs/compiler.py | 1 - .../types/user_and_chats/user_status.py | 116 ------------------ 2 files changed, 117 deletions(-) delete mode 100644 pyrogram/client/types/user_and_chats/user_status.py diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py index 36368bf9..d678b370 100644 --- a/compiler/docs/compiler.py +++ b/compiler/docs/compiler.py @@ -279,7 +279,6 @@ def pyrogram_api(): users_chats=""" Users & Chats User - UserStatus Chat ChatPreview ChatPhoto diff --git a/pyrogram/client/types/user_and_chats/user_status.py b/pyrogram/client/types/user_and_chats/user_status.py deleted file mode 100644 index 4d12afc1..00000000 --- a/pyrogram/client/types/user_and_chats/user_status.py +++ /dev/null @@ -1,116 +0,0 @@ -# Pyrogram - Telegram MTProto API Client Library for Python -# Copyright (C) 2017-2019 Dan Tès -# -# This file is part of Pyrogram. -# -# Pyrogram is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Pyrogram is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with Pyrogram. If not, see . - -import pyrogram - -from pyrogram.api import types -from ..object import Object -from ..update import Update - - -class UserStatus(Object, Update): - """A User status (Last Seen privacy). - - .. note:: - - You won't see exact last seen timestamps for people with whom you don't share your own. Instead, you get - "recently", "within_week", "within_month" or "long_time_ago" fields set. - - Parameters: - user_id (``int``): - User's id. - - online (``bool``, *optional*): - True if the user is online in this very moment, None otherwise. - If True, the "date" field will be also set containing the online expiration date (i.e.: the date when a - user will automatically go offline in case of no action by his client). - - offline (``bool``, *optional*): - True if the user is offline in this moment and has the Last Seen privacy setting public, None otherwise. - If True, the "date" field will be also set containing the last seen date (i.e.: the date when a user - was online the last time). - - date (``int``, *optional*): - Exact date in unix time. Available only in case "online" or "offline" equals to True. - - recently (``bool``, *optional*): - True for users with hidden Last Seen privacy that have been online between 1 second and 2-3 days ago, - None otherwise. - - within_week (``bool``, *optional*): - True for users with hidden Last Seen privacy that have been online between 2-3 and seven days ago, - None otherwise. - - within_month (``bool``, *optional*): - True for users with hidden Last Seen privacy that have been online between 6-7 days and a month ago, - None otherwise. - - long_time_ago (``bool``, *optional*): - True for users with hidden Last Seen privacy that have been online more than a month ago (this is also - always shown to blocked users), None otherwise. - """ - - __slots__ = ["user_id", "online", "offline", "date", "recently", "within_week", "within_month", "long_time_ago"] - - def __init__( - self, - *, - client: "pyrogram.BaseClient" = None, - user_id: int, - online: bool = None, - offline: bool = None, - date: int = None, - recently: bool = None, - within_week: bool = None, - within_month: bool = None, - long_time_ago: bool = None - ): - super().__init__(client) - - self.user_id = user_id - self.online = online - self.offline = offline - self.date = date - self.recently = recently - self.within_week = within_week - self.within_month = within_month - self.long_time_ago = long_time_ago - - @staticmethod - def _parse(client, user_status, user_id: int, is_bot: bool = False): - if is_bot: - return None - - status = UserStatus(user_id=user_id, client=client) - - if isinstance(user_status, types.UserStatusOnline): - status.online = True - status.date = user_status.expires - elif isinstance(user_status, types.UserStatusOffline): - status.offline = True - status.date = user_status.was_online - elif isinstance(user_status, types.UserStatusRecently): - status.recently = True - elif isinstance(user_status, types.UserStatusLastWeek): - status.within_week = True - elif isinstance(user_status, types.UserStatusLastMonth): - status.within_month = True - else: - status.long_time_ago = True - - return status