2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-22 19:10:53 +08:00

增加#扫码绑定指令开关(#56)

This commit is contained in:
ctrlcvs 2023-04-15 07:38:17 +08:00
parent ee7d0bf5f8
commit f1cf0a8540
3 changed files with 28 additions and 2 deletions

View File

@ -19,6 +19,7 @@ let cfgMap = {
"模板": "mb.len",
"获取sk":"ck.sk",
"目录":"Atlas.all",
"扫码绑定":'mhy.qrcode',
};
let sysCfgReg = `^#图鉴设置\s*(${lodash.keys(cfgMap).join("|")})?\s*(.*)$`;
export const rule = {
@ -74,6 +75,8 @@ export async function sysCfg(e, {
val = Math.min(200, Math.max(50, val * 1 || 100));
}else if(cfgKey === "mb.len"){
val= Math.min(2,Math.max(val,0));
}else if(cfgKey==='mhy.qrcode'){
val= Math.min(3,Math.max(val,0));
} else {
val = !/关闭/.test(val);
}
@ -88,6 +91,7 @@ export async function sysCfg(e, {
len:Cfg.get("mb.len", 0),
poke: getStatus("note.poke",false),
isSk: getStatus("ck.sk",false),
qrcode:Cfg.get("mhy.qrcode", 0),
imgPlus: fs.existsSync(plusPath),
notePlus: fs.existsSync(notePlus),
bg: await rodom(), //获取底图

View File

@ -5,6 +5,9 @@ import mys from "../model/mhyTopUpLogin.js"
import Common from "../components/Common.js";
import { bindStoken } from './user.js'
import utils from '../model/mys/utils.js';
import {
Cfg,
} from "../components/index.js";
const _path = process.cwd();
export const rule = {
qrCodeLogin: {
@ -41,6 +44,17 @@ export async function payOrder(e, { render }) {
}
export async function qrCodeLogin(e, { render }) {
let power = Cfg.get("mhy.qrcode")
if (power === 3) {
return false;
} else {
if (power == 2 && !e.isPrivate) {
return false;
}
if (power == 1 && !e.isGroup) {
return false;
}
}
let Mys = new mys(e)
let res = await Mys.qrCodeLogin()
if (!res?.data) return false;

View File

@ -119,6 +119,14 @@
</div>
<div class="cfg-desc">开启后将拦截login_ticket自动获取stoken</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
扫码绑定
<span class="cfg-hint">#图鉴设置扫码绑定 + (0~3)</span>
<div class="cfg-status">{{@qrcode}}</div>
</div>
<div class="cfg-desc">0不限制1限制群聊使用2限制私聊使用3禁用功能</div>
</li>
<li class="cfg-li">
<div class="cfg-line">
图鉴作为默认帮助