🎨send_log 命令添加 reply_chat_action

This commit is contained in:
洛水居室 2022-10-17 18:11:57 +08:00
parent adec83108a
commit 0120984991
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -1,6 +1,7 @@
import os import os
from telegram import Update from telegram import Update
from telegram.constants import ChatAction
from telegram.ext import CommandHandler, CallbackContext from telegram.ext import CommandHandler, CallbackContext
from core.plugin import Plugin, handler from core.plugin import Plugin, handler
@ -20,10 +21,12 @@ class Log(Plugin):
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) and os.path.getsize(error_log) > 0: if os.path.exists(error_log) and os.path.getsize(error_log) > 0:
await message.reply_chat_action(ChatAction.UPLOAD_DOCUMENT)
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) and os.path.getsize(debug_log) > 0: if os.path.exists(debug_log) and os.path.getsize(debug_log) > 0:
await message.reply_chat_action(ChatAction.UPLOAD_DOCUMENT)
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("调试日记未找到")