mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-09 17:33:44 +00:00
Move prepare object
This commit is contained in:
parent
3951e25e9f
commit
ae50e578b9
1 changed files with 12 additions and 12 deletions
|
|
@ -8,18 +8,6 @@ class Bot(BaseBot):
|
||||||
Based on :class:`aiogram.bot.BaseBot` and in this module is realized data serialization.
|
Based on :class:`aiogram.bot.BaseBot` and in this module is realized data serialization.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def prepare_object(self, obj, parent=None):
|
|
||||||
"""
|
|
||||||
Setup bot instance and objects tree for object
|
|
||||||
|
|
||||||
:param obj: instance of :class:`types.base.Deserializable`
|
|
||||||
:param parent: first parent object
|
|
||||||
:return: configured object
|
|
||||||
"""
|
|
||||||
obj.bot = self
|
|
||||||
obj.parent = parent
|
|
||||||
return obj
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
async def me(self) -> types.User:
|
async def me(self) -> types.User:
|
||||||
"""
|
"""
|
||||||
|
|
@ -41,6 +29,18 @@ class Bot(BaseBot):
|
||||||
if hasattr(self, '_me'):
|
if hasattr(self, '_me'):
|
||||||
delattr(self, '_me')
|
delattr(self, '_me')
|
||||||
|
|
||||||
|
def prepare_object(self, obj, parent=None):
|
||||||
|
"""
|
||||||
|
Setup bot instance and objects tree for object
|
||||||
|
|
||||||
|
:param obj: instance of :class:`types.base.Deserializable`
|
||||||
|
:param parent: first parent object
|
||||||
|
:return: configured object
|
||||||
|
"""
|
||||||
|
obj.bot = self
|
||||||
|
obj.parent = parent
|
||||||
|
return obj
|
||||||
|
|
||||||
async def download_file(self, file_path: str, destination: io.BytesIO or str = None, timeout: int = 30,
|
async def download_file(self, file_path: str, destination: io.BytesIO or str = None, timeout: int = 30,
|
||||||
chunk_size: int = 65536, seek: bool = True) -> io.BytesIO:
|
chunk_size: int = 65536, seek: bool = True) -> io.BytesIO:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue