mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-01 01:30:04 +08:00
update
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from models.group_member_info import GroupInfoUser
|
||||
|
||||
|
||||
# 生成通用排行榜
|
||||
async def init_rank(users: list, all_user_data: list, group_id: int):
|
||||
all_user_id = [user.user_qq for user in users]
|
||||
rst = ''
|
||||
for i in range(len(all_user_id) if len(all_user_id) < 10 else 10):
|
||||
_max = max(all_user_data)
|
||||
max_user_id = all_user_id[all_user_data.index(_max)]
|
||||
all_user_id.remove(max_user_id)
|
||||
all_user_data.remove(_max)
|
||||
try:
|
||||
user_name = (await GroupInfoUser.select_member_info(max_user_id, group_id)).user_name
|
||||
except AttributeError:
|
||||
user_name = f'{max_user_id}'
|
||||
rst += f'{user_name}: {_max}\n'
|
||||
return rst[:-1]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user