debug
This commit is contained in:
@@ -16,6 +16,7 @@ from db.connection import DBConnectionManager
|
||||
from db.points_db import PointsDBOperator, PointSource
|
||||
from utils.decorator.plugin_decorators import plugin_stats_decorator
|
||||
from utils.robot_cmd.robot_command import Feature, PermissionStatus
|
||||
from utils.wechat.contact_manager import ContactManager
|
||||
|
||||
|
||||
class LuckyPotRoom:
|
||||
@@ -249,7 +250,7 @@ class LuckyPotPlugin(MessagePluginInterface):
|
||||
)
|
||||
|
||||
# 创建者自动加入房间
|
||||
nickname = self._get_nickname(message, sender)
|
||||
nickname = ContactManager.get_instance().get_group_name(room_id, sender) or sender
|
||||
room.add_player(sender, nickname)
|
||||
|
||||
# 扣除创建者积分
|
||||
@@ -357,7 +358,7 @@ class LuckyPotPlugin(MessagePluginInterface):
|
||||
return True, "扣除积分失败"
|
||||
|
||||
# 获取用户昵称
|
||||
nickname = self._get_nickname(message, sender)
|
||||
nickname = ContactManager.get_instance().get_group_name(roomid, sender) or sender
|
||||
|
||||
# 添加用户到房间
|
||||
room.add_player(sender, nickname)
|
||||
@@ -676,10 +677,3 @@ class LuckyPotPlugin(MessagePluginInterface):
|
||||
message += f"{emoji} {player_name}: {reward} 积分 ({profit_text})\n"
|
||||
|
||||
return message
|
||||
|
||||
def _get_nickname(self, message: Dict[str, Any], user_id: str) -> str:
|
||||
"""获取用户昵称"""
|
||||
all_contacts = message.get("all_contacts", {})
|
||||
if user_id in all_contacts:
|
||||
return all_contacts[user_id].get("nickname", user_id)
|
||||
return user_id
|
||||
|
||||
Reference in New Issue
Block a user