mirror of
https://github.com/civsocit/olgram.git
synced 2025-12-16 01:46:17 +00:00
minor changes, auto-certificate
This commit is contained in:
@@ -31,10 +31,9 @@ async def register_token(bot: Bot) -> bool:
|
|||||||
a_bot = AioBot(bot.token)
|
a_bot = AioBot(bot.token)
|
||||||
certificate = None
|
certificate = None
|
||||||
if ServerSettings.use_custom_cert():
|
if ServerSettings.use_custom_cert():
|
||||||
with open(ServerSettings.public_path(), "r") as file:
|
certificate = open(ServerSettings.public_path(), 'rb')
|
||||||
certificate = file.read()
|
|
||||||
|
|
||||||
res = await a_bot.set_webhook(url_for_bot(bot), certificate=certificate)
|
res = await a_bot.set_webhook(url_for_bot(bot), certificate=certificate, drop_pending_updates=True)
|
||||||
await a_bot.session.close()
|
await a_bot.session.close()
|
||||||
del a_bot
|
del a_bot
|
||||||
return res
|
return res
|
||||||
@@ -47,7 +46,7 @@ async def unregister_token(token: str):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
bot = AioBot(token)
|
bot = AioBot(token)
|
||||||
await bot.delete_webhook()
|
await bot.delete_webhook(drop_pending_updates=True)
|
||||||
await bot.session.close()
|
await bot.session.close()
|
||||||
del bot
|
del bot
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user