MTPyroger/pyrogram/client/methods/users/get_me.py

40 lines
1.4 KiB
Python
Raw Normal View History

2018-01-23 14:34:36 +00:00
# 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 import functions, types
2018-05-07 14:45:05 +00:00
from ...ext import BaseClient, utils
2018-01-23 14:34:36 +00:00
class GetMe(BaseClient):
2018-06-19 11:48:49 +00:00
async def get_me(self):
2018-05-07 14:45:05 +00:00
"""A simple method for testing your authorization. Requires no parameters.
2018-01-23 14:34:36 +00:00
Returns:
2018-05-07 14:45:05 +00:00
Basic information about the user or bot in form of a :obj:`User` object
Raises:
:class:`Error <pyrogram.Error>`
"""
2018-05-07 14:45:05 +00:00
return utils.parse_user(
2018-06-19 11:48:49 +00:00
await self.send(
2018-05-07 14:45:05 +00:00
functions.users.GetFullUser(
types.InputPeerSelf()
)
).user
)