mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
feat: 自定义角色图上传
This commit is contained in:
parent
be1c00db59
commit
64275de0e8
11 changed files with 498 additions and 326 deletions
50
apps/manage/guides.js
Normal file
50
apps/manage/guides.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import guides from '../../lib/guides.js';
|
||||
import settings from '../../lib/settings.js';
|
||||
|
||||
/** 设置默认攻略 */
|
||||
export async function setDefaultGuide() {
|
||||
if (!this.e.isMaster) {
|
||||
this.reply('仅限主人设置');
|
||||
return false;
|
||||
}
|
||||
const match = /设置默认攻略(\d+|all)$/g.exec(this.e.msg);
|
||||
let guide_id = match[1];
|
||||
if (guide_id == 'all') {
|
||||
guide_id = 0;
|
||||
}
|
||||
guide_id = Number(guide_id);
|
||||
if (guide_id > guides.guideMaxNum) {
|
||||
const reply_msg = [
|
||||
'绝区零默认攻略设置方式为:',
|
||||
'%设置默认攻略[0123...]',
|
||||
`请增加数字0-${guides.guideMaxNum}其中一个,或者增加 all 以显示所有攻略`,
|
||||
'攻略来源请输入 %攻略帮助 查看',
|
||||
];
|
||||
await this.e.reply(reply_msg.join('\n'));
|
||||
return;
|
||||
}
|
||||
settings.setSingleConfig('guide', 'default_guide', guide_id);
|
||||
|
||||
const source_name = guide_id == 0 ? 'all' : this.source[guide_id - 1];
|
||||
await this.e.reply(`绝区零默认攻略已设置为: ${guide_id} (${source_name})`);
|
||||
}
|
||||
|
||||
/** 设置所有攻略显示个数 */
|
||||
export async function setMaxForwardGuide() {
|
||||
if (!this.e.isMaster) {
|
||||
this.reply('仅限主人设置');
|
||||
return false;
|
||||
}
|
||||
const match = /设置所有攻略显示个数(\d+)$/g.exec(this.e.msg);
|
||||
const max_forward_guide = Number(match[1]);
|
||||
if (max_forward_guide < 1) {
|
||||
await this.e.reply('所有攻略显示个数不能小于1');
|
||||
return false;
|
||||
}
|
||||
if (max_forward_guide > guides.guideMaxNum) {
|
||||
await this.e.reply(`所有攻略显示个数不能大于${guides.guideMaxNum}`);
|
||||
return false;
|
||||
}
|
||||
settings.setSingleConfig('guide', 'max_forward_guides', max_forward_guide);
|
||||
await this.e.reply(`绝区零所有攻略显示个数已设置为: ${max_forward_guide}`);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue