Create LastSeen class

This commit is contained in:
Dan 2018-10-14 17:08:49 +02:00
parent 474388d8a4
commit 465dcac630
5 changed files with 50 additions and 2 deletions

View File

@ -506,6 +506,7 @@ def start():
f.write("\n 0xb0700028: \"pyrogram.client.types.Dialog\",") f.write("\n 0xb0700028: \"pyrogram.client.types.Dialog\",")
f.write("\n 0xb0700029: \"pyrogram.client.types.Dialogs\",") f.write("\n 0xb0700029: \"pyrogram.client.types.Dialogs\",")
f.write("\n 0xb0700030: \"pyrogram.client.types.ChatMembers\",") f.write("\n 0xb0700030: \"pyrogram.client.types.ChatMembers\",")
f.write("\n 0xb0700031: \"pyrogram.client.types.LastSeen\"")
f.write("\n}\n") f.write("\n}\n")

View File

@ -29,7 +29,7 @@ from .api.errors import Error
from .client.types import ( from .client.types import (
Audio, Chat, ChatMember, ChatMembers, ChatPhoto, Contact, Document, InputMediaPhoto, Audio, Chat, ChatMember, ChatMembers, ChatPhoto, Contact, Document, InputMediaPhoto,
InputMediaVideo, InputMediaDocument, InputMediaAudio, InputMediaAnimation, InputPhoneContact, 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, UserProfilePhotos, Venue, Animation, Video, VideoNote, Voice, CallbackQuery, Messages, ForceReply,
InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove
) )

View File

@ -36,5 +36,5 @@ from .messages_and_media import (
from .update import Update from .update import Update
from .user_and_chats import ( from .user_and_chats import (
Chat, ChatMember, ChatMembers, ChatPhoto, Chat, ChatMember, ChatMembers, ChatPhoto,
Dialog, Dialogs, User Dialog, Dialogs, User, LastSeen
) )

View File

@ -22,4 +22,5 @@ from .chat_members import ChatMembers
from .chat_photo import ChatPhoto from .chat_photo import ChatPhoto
from .dialog import Dialog from .dialog import Dialog
from .dialogs import Dialogs from .dialogs import Dialogs
from .last_seen import LastSeen
from .user import User from .user import User

View File

@ -0,0 +1,46 @@
# Pyrogram - Telegram MTProto API Client Library for Python
# Copyright (C) 2017-2018 Dan Tès <https://github.com/delivrance>
#
# 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 <http://www.gnu.org/licenses/>.
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