fix(platform.tg_adapter): import Forbidden instead of deprecated Unauthorized (#6765) (#6769)

This commit is contained in:
Lockinwize Lolite
2026-03-22 13:35:09 +08:00
committed by GitHub
parent e204790797
commit 3e68b7a3f3

View File

@@ -8,7 +8,7 @@ from typing import cast
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from telegram import BotCommand, Update
from telegram.constants import ChatType
from telegram.error import InvalidToken, Unauthorized
from telegram.error import Forbidden, InvalidToken
from telegram.ext import ApplicationBuilder, ContextTypes, ExtBot, filters
from telegram.ext import MessageHandler as TelegramMessageHandler
@@ -183,7 +183,7 @@ class TelegramPlatformAdapter(Platform):
)
except asyncio.CancelledError:
raise
except (Unauthorized, InvalidToken) as e:
except (Forbidden, InvalidToken) as e:
logger.error(
f"Telegram token is invalid or unauthorized: {e}. Polling stopped."
)