From 136136693f8910fe6e1f7e932615dc0f3a0177dc Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 17 Nov 2025 15:55:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E4=B9=8B=E5=90=8E=EF=BC=8C?= =?UTF-8?q?=E7=99=BB=E8=AE=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/decorator/points_decorator.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/utils/decorator/points_decorator.py b/utils/decorator/points_decorator.py index 3fa8fdb..89b7a57 100644 --- a/utils/decorator/points_decorator.py +++ b/utils/decorator/points_decorator.py @@ -89,18 +89,21 @@ def points_reward_decorator(points_calculator: Union[int, Callable], source_type logger.info(f"用户 {sender} 获得 {points} 积分奖励") levels_db = LevelsDBOperator(db_manager) ok, lvl = levels_db.add_exp(sender, roomid, points, source.value) - - # 如果响应中没有提到积分,添加积分信息 if "积分" not in response: response += f"\n🎁 恭喜获得 {points} 积分奖励!" - if ok and isinstance(lvl, dict) and "level" in lvl and "exp" in lvl: - title = levels_db.level_title(int(lvl['level'])) - response += f"\n🔰 当前等级: {lvl['level']}({title}) 经验: {lvl['exp']}" client_msg_id, create_time, new_msg_id = await bot.send_at_message( (roomid if roomid else sender), response, [sender] ) revoke.add_message_to_revoke(roomid, client_msg_id, create_time, new_msg_id, 5) + if ok and isinstance(lvl, dict) and "level" in lvl and "exp" in lvl: + title = levels_db.level_title(int(lvl['level'])) + level_msg = f"🔰 当前等级: {lvl['level']}({title}) 经验: {lvl['exp']}" + client_msg_id, create_time, new_msg_id = await bot.send_at_message( + (roomid if roomid else sender), + level_msg, [sender] + ) + revoke.add_message_to_revoke(roomid, client_msg_id, create_time, new_msg_id, 5) else: logger.warning(f"用户 {sender} 积分奖励失败: {reward_result}") except Exception as e: