Fix telegram application run loop
All checks were successful
publish-images / build (push) Successful in 6s
All checks were successful
publish-images / build (push) Successful in 6s
This commit is contained in:
@@ -1,8 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
import logging
|
import logging
|
||||||
from functools import partial
|
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||||
@@ -72,7 +70,7 @@ async def callback_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) -
|
|||||||
await query.edit_message_text(text=text, reply_markup=build_keyboard(), parse_mode=ParseMode.HTML)
|
await query.edit_message_text(text=text, reply_markup=build_keyboard(), parse_mode=ParseMode.HTML)
|
||||||
|
|
||||||
|
|
||||||
async def main() -> None:
|
def main() -> None:
|
||||||
settings = Settings.from_env()
|
settings = Settings.from_env()
|
||||||
client = BoincClient(
|
client = BoincClient(
|
||||||
host=settings.boinc_host,
|
host=settings.boinc_host,
|
||||||
@@ -91,8 +89,8 @@ async def main() -> None:
|
|||||||
application.add_handler(CallbackQueryHandler(callback_handler))
|
application.add_handler(CallbackQueryHandler(callback_handler))
|
||||||
|
|
||||||
logger.info("Starting Telegram bot...")
|
logger.info("Starting Telegram bot...")
|
||||||
await application.run_polling(close_loop=False)
|
application.run_polling()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main())
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user