mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-16 12:07:13 +00:00
Make more easy API request from bot object.
This commit is contained in:
parent
89928cf057
commit
a0a583ebca
1 changed files with 4 additions and 1 deletions
|
|
@ -41,6 +41,9 @@ class AIOGramBot:
|
|||
setattr(self, '_me', await self.get_me())
|
||||
return getattr(self, '_me')
|
||||
|
||||
async def request(self, method, data=None):
|
||||
return await api.request(self.session, self.__token, method, data)
|
||||
|
||||
async def get_me(self) -> User:
|
||||
raw = await api.request(self.session, self.__token, ApiMethods.GET_ME)
|
||||
raw = await self.request(ApiMethods.GET_ME)
|
||||
return self._prepare_object(User.de_json(raw))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue