token fix

This commit is contained in:
mihalin 2021-09-10 00:00:18 +03:00
parent 6deaff27b0
commit b740b04d2b

View File

@ -23,6 +23,7 @@ async def register_token(bot: Bot) -> bool:
:param bot: Бот :param bot: Бот
:return: получилось ли :return: получилось ли
""" """
await unregister_token(bot.token)
a_bot = AioBot(bot.token) a_bot = AioBot(bot.token)
res = await a_bot.set_webhook(url_for_bot(bot)) res = await a_bot.set_webhook(url_for_bot(bot))
await a_bot.session.close() await a_bot.session.close()
@ -36,6 +37,7 @@ async def unregister_token(token: str):
:return: :return:
""" """
bot = AioBot(token) bot = AioBot(token)
await bot.session.close()
await bot.delete_webhook() await bot.delete_webhook()