From 3951e25e9f36629f19232a316fc3983c9d263909 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Mon, 24 Jul 2017 23:39:41 +0300 Subject: [PATCH] Allow to reset `bot.me` --- aiogram/bot/bot.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/aiogram/bot/bot.py b/aiogram/bot/bot.py index 1c1675fa..e5ff6e7f 100644 --- a/aiogram/bot/bot.py +++ b/aiogram/bot/bot.py @@ -23,7 +23,7 @@ class Bot(BaseBot): @property async def me(self) -> types.User: """ - Alias for self.get_me() but with caching. + Alias for self.get_me() but lazy and with caching. :return: :class:`aiogram.types.User` """ @@ -31,6 +31,16 @@ class Bot(BaseBot): setattr(self, '_me', await self.get_me()) return getattr(self, '_me') + @me.deleter + def me(self): + """ + Reset `me` + + :return: + """ + if hasattr(self, '_me'): + delattr(self, '_me') + 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: """