"""Print Telegram's current webhook status for diagnostics."""
from __future__ import annotations

import asyncio

from aiogram import Bot

from config import Settings


async def main() -> None:
    settings = Settings.from_env()
    bot = Bot(settings.bot_token)
    try:
        info = await bot.get_webhook_info()
        print(f"URL: {info.url or '-'}")
        print(f"Pending updates: {info.pending_update_count}")
        print(f"Last error date: {info.last_error_date or '-'}")
        print(f"Last error message: {info.last_error_message or '-'}")
    finally:
        await bot.session.close()


if __name__ == "__main__":
    asyncio.run(main())
