#喵喵设置增加面板排行人数自定义,范围5~30,默认15 (#434)

This commit is contained in:
SunRyK 2023-02-03 23:05:43 +08:00 committed by GitHub
parent 0427f6788a
commit f5f6319ea1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View File

@ -60,7 +60,7 @@ app.reg('profile-list', profileList, {
})
app.reg('profile-stat', profileStat, {
rule: /^#(面板|喵喵)?练度统计$/,
rule: /^#(面板|喵喵|角色|武器|天赋|技能|圣遗物)?练度统计$/,
name: '面板练度统计$'
})

View File

@ -3,7 +3,7 @@ import {Cfg, Common, Data } from '../../components/index.js'
import { AvatarList, ProfileRank } from '../../models/index.js'
export async function profileStat (e) {
let isMatch = /^#(喵喵|面板)练度统计?$/.test(e.original_msg || e.msg || '')
let isMatch = /^#(面板|喵喵|角色|武器|天赋|技能|圣遗物)练度统计?$/.test(e.original_msg || e.msg || '')
if (!Cfg.get('profileStat', false) && !isMatch) {
return false
}

View File

@ -14,6 +14,9 @@ export const uploadAbyssData = false
// 使用【#面板练度统计】功能取代【#练度统计】功能,默认关闭
export const profileStat = false
// 可选值5~30建议15。设置高排行人数会导致渲染图片速度加长发送缓慢
export const rankNumber = 15
// 老婆查询
export const avatarWife = true

View File

@ -49,6 +49,14 @@ export const cfgSchema = {
oldCfgKey: 'profile.stat',
desc: '使用【#面板练度统计】功能取代【#练度统计】功能,默认关闭'
},
rankNumber: {
title: '排行人数',
key: '排行人数',
type: 'num',
def: 15,
input: (n) => Math.min(30, Math.max(5, (n * 1 || 15))),
desc: '可选值5~30建议15。设置高排行人数会导致渲染图片速度加长发送缓慢'
},
avatarWife: {
title: '老婆查询',
key: '老婆',

View File

@ -1,6 +1,6 @@
import lodash from 'lodash'
import moment from 'moment'
import { Common, Data } from '../components/index.js'
import { Cfg, Common, Data, } from '../components/index.js'
export default class ProfileRank {
constructor (data) {
@ -151,7 +151,8 @@ export default class ProfileRank {
* @returns {Promise<ConvertArgumentType<ZMember, string>[]|boolean>}
*/
static async getGroupUidList (groupId, charId, type = 'mark') {
let uids = await redis.zRangeWithScores(`miao:rank:${groupId}:${type}:${charId}`, -20, -1)
let number = Cfg.get('rankNumber', 15)
let uids = await redis.zRangeWithScores(`miao:rank:${groupId}:${type}:${charId}`, -`${number}`, -1)
return uids ? uids.reverse() : false
}