mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-17 13:47:44 +00:00
按钮能力支持
This commit is contained in:
parent
800bc15007
commit
d390381a12
3 changed files with 161 additions and 12 deletions
62
lain.support.js
Normal file
62
lain.support.js
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
export default class Button {
|
||||
constructor() {
|
||||
this.plugin = {
|
||||
name: 'zzz-plugin-support-global',
|
||||
dsc: 'zzz-plugin button support (uses global vars)',
|
||||
priority: 50, // 确保在 Panel(70) 之后运行
|
||||
rule: [
|
||||
{ reg: '#绝区零更新面板|#绝区零面板更新|#绝区零刷新面板|#绝区零面板刷新$', fnc: 'profile1' },
|
||||
{ reg: '#绝区零(.*)面板(.*)$', fnc: 'handleRule' },
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
profile1(e) {
|
||||
const roleList = global.zzzRoleList || [];
|
||||
const ifNewChar = global.ifNewChar || false;
|
||||
|
||||
const button = [];
|
||||
|
||||
const staticList = [
|
||||
{ label: `更新面板`, callback: `%更新面板` },
|
||||
{ label: '绑定UID', callback: `%绑定` },
|
||||
{ label: '扫码绑定', callback: `#扫码登录` },
|
||||
{ label: '绑定设备', callback: `%绑定设备帮助` },
|
||||
];
|
||||
|
||||
button.push(...Bot.Button(staticList));
|
||||
|
||||
if (ifNewChar && roleList.length > 0) {
|
||||
const charButtonList = roleList.map(role => ({
|
||||
label: role, callback: `%${role}面板`
|
||||
}));
|
||||
button.push(...Bot.Button(charButtonList, 4));
|
||||
} else {
|
||||
}
|
||||
|
||||
return button.length > 0 ? button : null;
|
||||
}
|
||||
|
||||
handleRule(e) {
|
||||
let charName = '';
|
||||
if (global.zzzCurrentCharName) {
|
||||
charName = global.zzzCurrentCharName;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const buttonRows = [
|
||||
[{ label: `更新面板`, callback: `%更新面板` }],
|
||||
[
|
||||
{ label: `${charName}攻略`, callback: `%${charName}攻略` },
|
||||
{ label: `练度统计`, callback: `%练度统计` },
|
||||
{ label: `${charName}图鉴`, callback: `%${charName}图鉴` },
|
||||
],
|
||||
[{ label: `签到`, callback: `%签到` }, { label: `伤害`, callback: `%${charName}伤害` } { label: `电量`, callback: `%体力` }] // 可以合并常用的
|
||||
];
|
||||
|
||||
return Bot.Button(buttonRows);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue