mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-21 22:58:05 +00:00
🎨 Update error handler for UpdatePlugin
This commit is contained in:
parent
a7f597708f
commit
9c8def3ce9
@ -4,7 +4,7 @@ from sys import executable
|
||||
|
||||
from aiofiles import open as async_open
|
||||
from telegram import Update, Message
|
||||
from telegram.error import BadRequest, Forbidden
|
||||
from telegram.error import NetworkError
|
||||
from telegram.ext import CallbackContext, CommandHandler
|
||||
|
||||
from core.bot import bot
|
||||
@ -37,9 +37,10 @@ class UpdatePlugin(Plugin):
|
||||
try:
|
||||
reply_text = Message.de_json(data, bot.app.bot)
|
||||
await reply_text.edit_text("重启成功")
|
||||
except (BadRequest, Forbidden, KeyError) as exc:
|
||||
logger.error("UpdatePlugin 编辑消息出现错误")
|
||||
logger.exception(exc)
|
||||
except NetworkError as exc:
|
||||
logger.error("UpdatePlugin 编辑消息出现错误 %s", exc.message)
|
||||
except KeyError as exc:
|
||||
logger.error("UpdatePlugin 编辑消息出现错误", exc_info=exc)
|
||||
os.remove(UPDATE_DATA)
|
||||
|
||||
@handler(CommandHandler, command="update", block=False)
|
||||
|
Loading…
Reference in New Issue
Block a user