使用通讯录内容,优化性能
This commit is contained in:
@@ -14,6 +14,7 @@ from utils.robot_cmd.robot_command import Feature, PermissionStatus, GroupBotMan
|
||||
|
||||
import mysql.connector.pooling
|
||||
|
||||
from utils.wechat.contact_manager import ContactManager
|
||||
from wechat_ipad import WechatAPIClient
|
||||
from wechat_ipad.models.message import WxMessage
|
||||
|
||||
@@ -367,12 +368,14 @@ class PointTradePlugin(MessagePluginInterface):
|
||||
|
||||
# 构建排行榜消息
|
||||
rank_list = []
|
||||
con = ContactManager.get_instance()
|
||||
for i, user in enumerate(ranking, 1):
|
||||
user_id = user.get('user_id', '')
|
||||
points = user.get('total_points', 0)
|
||||
|
||||
# 获取用户昵称
|
||||
user_info = await self.bot.get_chatroom_nickname(user_id, roomid)
|
||||
# user_info = await self.bot.get_chatroom_nickname(user_id, roomid)
|
||||
user_info = con.get_group_name(roomid, user_id) or user_id
|
||||
|
||||
# 添加排名标记
|
||||
rank_mark = "🥇" if i == 1 else "🥈" if i == 2 else "🥉" if i == 3 else f"{i}."
|
||||
|
||||
Reference in New Issue
Block a user