fix: reduce verbose web and bot logs

This commit is contained in:
ngfchl
2026-07-07 08:46:26 +08:00
parent a60c56da01
commit e3e9893812
4 changed files with 19 additions and 9 deletions
+3 -3
View File
@@ -58,7 +58,7 @@ async def cmd_ban(update: Update, context: ContextTypes.DEFAULT_TYPE):
await Action.create(action="BAN", user_id=user_id, username=target, operator_id=update.effective_user.id)
reply = await update.message.reply_text(f"🔨 已封禁 {target} ({user_id}) {config.BAN_DURATION_MINUTES} 分钟")
except Exception as e:
logger.exception("手动封禁失败")
logger.error(f"手动封禁失败: {type(e).__name__}: {e}")
reply = await update.message.reply_text(f"❌ 封禁失败: {e}")
asyncio.create_task(auto_delete(reply))
@@ -81,7 +81,7 @@ async def cmd_unban(update: Update, context: ContextTypes.DEFAULT_TYPE):
await Action.create(action="UNBAN", user_id=user_id, username=target, operator_id=update.effective_user.id)
reply = await update.message.reply_text(f"🔓 已解封用户 {target} ({user_id})")
except Exception as e:
logger.exception("手动解封失败")
logger.error(f"手动解封失败: {type(e).__name__}: {e}")
reply = await update.message.reply_text(f"❌ 解封失败: {e}")
asyncio.create_task(auto_delete(reply))
@@ -140,7 +140,7 @@ async def cmd_mute(update: Update, context: ContextTypes.DEFAULT_TYPE):
await Action.create(action="MUTE", user_id=user_id, username=target, operator_id=update.effective_user.id, details={"minutes": minutes})
reply = await update.message.reply_text(f"🔇 已禁言 {target} ({user_id}) {minutes} 分钟")
except Exception as e:
logger.exception("禁言失败")
logger.error(f"禁言失败: {type(e).__name__}: {e}")
reply = await update.message.reply_text(f"❌ 禁言失败: {e}")
asyncio.create_task(auto_delete(reply))
+1 -1
View File
@@ -121,7 +121,7 @@ async def cmd_ask(update: Update, context: ContextTypes.DEFAULT_TYPE):
asyncio.create_task(auto_delete(reply, seconds=60))
return
logger.info(f"📩 用户提问: [{update.message.from_user.username}] {query}")
logger.debug(f"📩 用户提问: [{update.message.from_user.username}] {query[:80]}")
searching_msg = await safe_send(update, context, "🔍 正在搜索知识库并整理详细答案...")
asyncio.create_task(auto_delete(update.message, seconds=60))
+1 -1
View File
@@ -30,7 +30,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
username = user.username or ""
first_name = user.first_name or ""
text = msg.text
logger.info(f"💬 聊天消息 [{username or first_name or user.id}]: {text[:120]}")
logger.debug(f"💬 聊天消息 [{username or first_name or user.id}]: {text[:80]}")
# === 防刷屏 ===
now = datetime.now().timestamp()