get_me method needed for legacy mode
This commit is contained in:
parent
0ac4553591
commit
f689d9b95a
@ -7,7 +7,7 @@ __author__ = "Davide Testa"
|
||||
__email__ = "davide@davte.it"
|
||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||
__license__ = "GNU General Public License v3.0"
|
||||
__version__ = "2.0.1"
|
||||
__version__ = "2.0.2"
|
||||
__maintainer__ = "Davide Testa"
|
||||
__contact__ = "t.me/davte"
|
||||
|
||||
|
@ -1881,6 +1881,25 @@ class Bot(telepot.aio.Bot, Gettable):
|
||||
error=None
|
||||
)
|
||||
|
||||
async def get_me(self):
|
||||
"""Get bot information.
|
||||
|
||||
Restart bots if bot can't be got.
|
||||
"""
|
||||
try:
|
||||
me = await self.getMe()
|
||||
self.bot_name = me["username"]
|
||||
self.telegram_id = me['id']
|
||||
except Exception as e:
|
||||
logging.error(
|
||||
"Could not get bot\n{e}".format(
|
||||
e=e
|
||||
)
|
||||
)
|
||||
await asyncio.sleep(5*60)
|
||||
self.restart_bots()
|
||||
return
|
||||
|
||||
async def continue_running(self):
|
||||
"""Get updates.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user