积分玩法加上撤回功能
This commit is contained in:
@@ -7,6 +7,7 @@ from typing import Callable, Dict, Any, Tuple, Union
|
||||
|
||||
from db.connection import DBConnectionManager
|
||||
from db.points_db import PointsDBOperator, PointSource
|
||||
from utils.revoke.message_auto_revoke import MessageAutoRevoke
|
||||
from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotManager
|
||||
from wechat_ipad import WechatAPIClient
|
||||
|
||||
@@ -203,7 +204,7 @@ def plugin_points_cost(points: int, description: str = None, feature: Feature =
|
||||
roomid = message.get("roomid", "")
|
||||
|
||||
bot: WechatAPIClient = message.get("bot")
|
||||
|
||||
revoke: MessageAutoRevoke = message.get("revoke")
|
||||
if not sender or not (roomid or sender):
|
||||
return await func(self, message)
|
||||
|
||||
@@ -242,10 +243,13 @@ def plugin_points_cost(points: int, description: str = None, feature: Feature =
|
||||
# 添加对 response 的类型检查
|
||||
if isinstance(response, str) and "积分" not in response:
|
||||
response += f"\n\n💰 已消费 {points} 积分"
|
||||
await bot.send_at_message(
|
||||
|
||||
client_msg_id, create_time, new_msg_id = await bot.send_at_message(
|
||||
(roomid if roomid else sender),
|
||||
f"💰消费 {points} 积分", [sender]
|
||||
)
|
||||
revoke.add_message_to_revoke(roomid, client_msg_id, create_time, new_msg_id, 5)
|
||||
|
||||
else:
|
||||
logger.warning(f"用户 {sender} 积分扣除失败: {deduct_result}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user