From 465dcac630fd07990225e55761a69862fb1ce28d Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 14 Oct 2018 17:08:49 +0200 Subject: [PATCH] Create LastSeen class --- compiler/api/compiler.py | 1 + pyrogram/__init__.py | 2 +- pyrogram/client/types/__init__.py | 2 +- .../client/types/user_and_chats/__init__.py | 1 + .../client/types/user_and_chats/last_seen.py | 46 +++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 pyrogram/client/types/user_and_chats/last_seen.py diff --git a/compiler/api/compiler.py b/compiler/api/compiler.py index bcb96ea4..4cce310a 100644 --- a/compiler/api/compiler.py +++ b/compiler/api/compiler.py @@ -506,6 +506,7 @@ def start(): f.write("\n 0xb0700028: \"pyrogram.client.types.Dialog\",") f.write("\n 0xb0700029: \"pyrogram.client.types.Dialogs\",") f.write("\n 0xb0700030: \"pyrogram.client.types.ChatMembers\",") + f.write("\n 0xb0700031: \"pyrogram.client.types.LastSeen\"") f.write("\n}\n") diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py index 6fb6fff4..cc6e9899 100644 --- a/pyrogram/__init__.py +++ b/pyrogram/__init__.py @@ -29,7 +29,7 @@ from .api.errors import Error from .client.types import ( Audio, Chat, ChatMember, ChatMembers, ChatPhoto, Contact, Document, InputMediaPhoto, InputMediaVideo, InputMediaDocument, InputMediaAudio, InputMediaAnimation, InputPhoneContact, - Location, Message, MessageEntity, Dialog, Dialogs, Photo, PhotoSize, Sticker, Update, User, + Location, Message, MessageEntity, Dialog, Dialogs, Photo, PhotoSize, Sticker, Update, User, LastSeen, UserProfilePhotos, Venue, Animation, Video, VideoNote, Voice, CallbackQuery, Messages, ForceReply, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove ) diff --git a/pyrogram/client/types/__init__.py b/pyrogram/client/types/__init__.py index 230d5e5d..a4b33e40 100644 --- a/pyrogram/client/types/__init__.py +++ b/pyrogram/client/types/__init__.py @@ -36,5 +36,5 @@ from .messages_and_media import ( from .update import Update from .user_and_chats import ( Chat, ChatMember, ChatMembers, ChatPhoto, - Dialog, Dialogs, User + Dialog, Dialogs, User, LastSeen ) diff --git a/pyrogram/client/types/user_and_chats/__init__.py b/pyrogram/client/types/user_and_chats/__init__.py index 45915edc..6711ab2c 100644 --- a/pyrogram/client/types/user_and_chats/__init__.py +++ b/pyrogram/client/types/user_and_chats/__init__.py @@ -22,4 +22,5 @@ from .chat_members import ChatMembers from .chat_photo import ChatPhoto from .dialog import Dialog from .dialogs import Dialogs +from .last_seen import LastSeen from .user import User diff --git a/pyrogram/client/types/user_and_chats/last_seen.py b/pyrogram/client/types/user_and_chats/last_seen.py new file mode 100644 index 00000000..7403039b --- /dev/null +++ b/pyrogram/client/types/user_and_chats/last_seen.py @@ -0,0 +1,46 @@ +# Pyrogram - Telegram MTProto API Client Library for Python +# Copyright (C) 2017-2018 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 . + +from pyrogram.api.core import Object + + +class LastSeen(Object): + """This object represents a User last seen status + """ + + ID = 0xb0700031 + + def __init__( + self, + online: bool = None, + offline: bool = None, + recently: bool = None, + within_week: bool = None, + within_month: bool = None, + long_time_ago: bool = None, + bot: bool = None, + date: int = None, + ): + self.online = online + self.offline = offline + self.recently = recently + self.within_week = within_week + self.within_month = within_month + self.long_time_ago = long_time_ago + self.bot = bot + self.date = date