mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-25 07:36:27 +00:00
🎨 给日记插件添加操作记录
This commit is contained in:
parent
0babbc7351
commit
a2aa8fbdc9
@ -5,6 +5,7 @@ from telegram.ext import CommandHandler, CallbackContext
|
|||||||
|
|
||||||
from core.plugin import Plugin, handler
|
from core.plugin import Plugin, handler
|
||||||
from utils.decorators.admins import bot_admins_rights_check
|
from utils.decorators.admins import bot_admins_rights_check
|
||||||
|
from utils.log import logger
|
||||||
|
|
||||||
current_dir = os.getcwd()
|
current_dir = os.getcwd()
|
||||||
error_log = os.path.join(current_dir, "logs", "error", "error.log")
|
error_log = os.path.join(current_dir, "logs", "error", "error.log")
|
||||||
@ -16,6 +17,8 @@ class Log(Plugin):
|
|||||||
@handler(CommandHandler, command="send_log", block=False)
|
@handler(CommandHandler, command="send_log", block=False)
|
||||||
@bot_admins_rights_check
|
@bot_admins_rights_check
|
||||||
async def send_log(self, update: Update, _: CallbackContext):
|
async def send_log(self, update: Update, _: CallbackContext):
|
||||||
|
user = update.effective_user
|
||||||
|
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):
|
||||||
await message.reply_document(open(error_log, mode='rb+'), caption="Error Log")
|
await message.reply_document(open(error_log, mode='rb+'), caption="Error Log")
|
||||||
|
Loading…
Reference in New Issue
Block a user