mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-14 12:17:48 +00:00
fix:刷新角色间隔改为毫秒
This commit is contained in:
parent
f1cc1dd673
commit
715b3f88f4
4 changed files with 18 additions and 12 deletions
|
|
@ -82,18 +82,18 @@ export async function setRefreshCharInterval() {
|
|||
}
|
||||
const match = /刷新角色间隔(\d+)$/g.exec(this.e.msg);
|
||||
const refresh_char_interval = Number(match[1]);
|
||||
if (refresh_char_interval < 0) {
|
||||
return this.e.reply('刷新角色间隔不能小于0秒', false, {
|
||||
if (refresh_char_interval < 100) {
|
||||
return this.e.reply('刷新角色间隔不能小于100毫秒', false, {
|
||||
at: true,
|
||||
recallMsg: 100,
|
||||
});
|
||||
}
|
||||
if (refresh_char_interval > 1000) {
|
||||
return this.e.reply('刷新角色间隔不能大于1000秒', false, {
|
||||
if (refresh_char_interval > 10000) {
|
||||
return this.e.reply('刷新角色间隔不能大于10000毫秒', false, {
|
||||
at: true,
|
||||
recallMsg: 100,
|
||||
});
|
||||
}
|
||||
settings.setSingleConfig('panel', 'roleInterval', refresh_char_interval);
|
||||
await this.e.reply(`绝区零刷新角色间隔已设置为: ${refresh_char_interval}秒`);
|
||||
await this.e.reply(`绝区零刷新角色间隔已设置为: ${refresh_char_interval}毫秒`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
interval: 60 # 刷新面板的时间间隔(单位:秒)
|
||||
roleInterval: 3 # 查询每个角色的间隔时间(单位:秒)
|
||||
roleInterval: 3000 # 查询每个角色的间隔时间(单位:毫秒)
|
||||
|
|
@ -184,14 +184,14 @@ export function supportGuoba() {
|
|||
field: 'panel.roleInterval',
|
||||
label: '冷却时间',
|
||||
bottomHelpMessage:
|
||||
'设置刷新角色的冷却时间,单位为秒,取值范围为0~1000',
|
||||
'设置刷新角色的冷却时间,单位为毫秒,取值范围为100~10000',
|
||||
component: 'InputNumber',
|
||||
required: true,
|
||||
componentProps: {
|
||||
min: 0,
|
||||
max: 1000,
|
||||
min: 100,
|
||||
max: 10000,
|
||||
placeholder: '请输入数字',
|
||||
addonAfter: "s",
|
||||
addonAfter: "ms",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,8 +48,14 @@ export const getAvatarInfoList = async (api, deviceFp, origin = false) => {
|
|||
},
|
||||
});
|
||||
avatarInfoList.push(data.avatar_list[0]);
|
||||
const time = _.get(settings.getConfig('panel'), 'roleInterval', 3) * 1000;
|
||||
await new Promise(resolve => setTimeout(resolve, time));
|
||||
const time = _.get(settings.getConfig('panel'), 'roleInterval', 3000);
|
||||
let refresh;
|
||||
if (time > 100) {
|
||||
refresh = time;
|
||||
} else {
|
||||
refresh = 100;
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, refresh));
|
||||
}
|
||||
if (!avatarInfoList?.length) return null;
|
||||
// 是否返回原始数据
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue