mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 09:37:30 +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 aiofiles import open as async_open
|
||||||
from telegram import Update, Message
|
from telegram import Update, Message
|
||||||
from telegram.error import BadRequest, Forbidden
|
from telegram.error import NetworkError
|
||||||
from telegram.ext import CallbackContext, CommandHandler
|
from telegram.ext import CallbackContext, CommandHandler
|
||||||
|
|
||||||
from core.bot import bot
|
from core.bot import bot
|
||||||
@ -37,9 +37,10 @@ class UpdatePlugin(Plugin):
|
|||||||
try:
|
try:
|
||||||
reply_text = Message.de_json(data, bot.app.bot)
|
reply_text = Message.de_json(data, bot.app.bot)
|
||||||
await reply_text.edit_text("重启成功")
|
await reply_text.edit_text("重启成功")
|
||||||
except (BadRequest, Forbidden, KeyError) as exc:
|
except NetworkError as exc:
|
||||||
logger.error("UpdatePlugin 编辑消息出现错误")
|
logger.error("UpdatePlugin 编辑消息出现错误 %s", exc.message)
|
||||||
logger.exception(exc)
|
except KeyError as exc:
|
||||||
|
logger.error("UpdatePlugin 编辑消息出现错误", exc_info=exc)
|
||||||
os.remove(UPDATE_DATA)
|
os.remove(UPDATE_DATA)
|
||||||
|
|
||||||
@handler(CommandHandler, command="update", block=False)
|
@handler(CommandHandler, command="update", block=False)
|
||||||
|
Loading…
Reference in New Issue
Block a user