mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-25 07:36:27 +00:00
🐛 增加判断 log 文件为空
This commit is contained in:
parent
8be2514ef2
commit
e32a4c6e99
@ -20,11 +20,11 @@ class Log(Plugin):
|
|||||||
user = update.effective_user
|
user = update.effective_user
|
||||||
logger.info(f"用户 {user.full_name}[{user.id}] send_log 命令请求")
|
logger.info(f"用户 {user.full_name}[{user.id}] send_log 命令请求")
|
||||||
message = update.effective_message
|
message = update.effective_message
|
||||||
if os.path.exists(error_log):
|
if os.path.exists(error_log) and os.path.getsize(error_log) > 0:
|
||||||
await message.reply_document(open(error_log, mode='rb+'), caption="Error Log")
|
await message.reply_document(open(error_log, mode='rb+'), caption="Error Log")
|
||||||
else:
|
else:
|
||||||
await message.reply_text("错误日记未找到")
|
await message.reply_text("错误日记未找到")
|
||||||
if os.path.exists(debug_log):
|
if os.path.exists(debug_log) and os.path.getsize(debug_log) > 0:
|
||||||
await message.reply_document(open(debug_log, mode='rb+'), caption="Debug Log")
|
await message.reply_document(open(debug_log, mode='rb+'), caption="Debug Log")
|
||||||
else:
|
else:
|
||||||
await message.reply_text("调试日记未找到")
|
await message.reply_text("调试日记未找到")
|
||||||
|
Loading…
Reference in New Issue
Block a user