mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 19:10:53 +08:00
新增cookies帮助指令
This commit is contained in:
parent
bc1510bb37
commit
4f294bed11
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,3 +1,13 @@
|
|||||||
|
# 1.1.3
|
||||||
|
* 下列功能需要绑定`cookies`来跑,非信任的bot请勿发送cookies
|
||||||
|
* 实现米游社多模块签到
|
||||||
|
* 实现米游社米游币获取
|
||||||
|
* 新增指令`cookies帮助`
|
||||||
|
* 新增指令`#米游社原神签到`
|
||||||
|
* 用于获取米游社米游币
|
||||||
|
* 新增指令`#崩坏3签到`
|
||||||
|
* 用于签到不同的社区模块
|
||||||
|
* 具体有`原神、崩坏3、崩坏2、未定事件簿、大别野、崩坏星穹铁道、绝区零`
|
||||||
# 1.1.2
|
# 1.1.2
|
||||||
* 初步实现米游社签到米游币以及社区签到
|
* 初步实现米游社签到米游币以及社区签到
|
||||||
* 需要引入包文件`cnpm i promise-retry `跟`cnpm i superagent`
|
* 需要引入包文件`cnpm i promise-retry `跟`cnpm i superagent`
|
||||||
|
@ -21,13 +21,13 @@ import {
|
|||||||
} from "../components/Changelog.js";
|
} from "../components/Changelog.js";
|
||||||
import {
|
import {
|
||||||
rule as signRule,
|
rule as signRule,
|
||||||
sign,mysSign
|
sign,mysSign,cookiesDocHelp
|
||||||
} from "./sign.js"
|
} from "./sign.js"
|
||||||
export {
|
export {
|
||||||
updateRes,
|
updateRes,
|
||||||
updateMiaoPlugin,sign,
|
updateMiaoPlugin,sign,
|
||||||
versionInfo,
|
versionInfo,
|
||||||
Note_appoint,pokeNote,
|
Note_appoint,pokeNote,cookiesDocHelp,
|
||||||
sysCfg,
|
sysCfg,
|
||||||
help,DailyNoteTask,
|
help,DailyNoteTask,
|
||||||
AtlasAlias,
|
AtlasAlias,
|
||||||
|
22
apps/sign.js
22
apps/sign.js
@ -10,7 +10,8 @@ import MysInfo from '../model/mys/mysInfo.js'
|
|||||||
import {
|
import {
|
||||||
isV3
|
isV3
|
||||||
} from '../components/Changelog.js';
|
} from '../components/Changelog.js';
|
||||||
import gsCfg from '../model/gsCfg.js'
|
import gsCfg from '../model/gsCfg.js';
|
||||||
|
|
||||||
export const rule = {
|
export const rule = {
|
||||||
mysSign: {
|
mysSign: {
|
||||||
reg: "^#*(米游社|mys|社区)(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零|全部)签到$",
|
reg: "^#*(米游社|mys|社区)(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零|全部)签到$",
|
||||||
@ -19,6 +20,10 @@ export const rule = {
|
|||||||
sign: {
|
sign: {
|
||||||
reg: "^#*(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零)签到$",
|
reg: "^#*(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零)签到$",
|
||||||
describe: "米社规则签到"
|
describe: "米社规则签到"
|
||||||
|
},
|
||||||
|
cookiesDocHelp: {
|
||||||
|
reg: "^#*(米游社|cookies|米游币)帮助$",
|
||||||
|
describe: "cookies获取帮助"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -30,6 +35,7 @@ const RETRY_OPTIONS = {
|
|||||||
minTimeout: 5000,
|
minTimeout: 5000,
|
||||||
maxTimeout: 10000
|
maxTimeout: 10000
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function sign(e) {
|
export async function sign(e) {
|
||||||
let isck=await cookie(e);
|
let isck=await cookie(e);
|
||||||
if (!isck) {
|
if (!isck) {
|
||||||
@ -167,8 +173,8 @@ async function cookie(e) {
|
|||||||
let cookie, uid;
|
let cookie, uid;
|
||||||
let miHoYoApi = new MihoYoApi(e);
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
let skuid;
|
let skuid;
|
||||||
|
let cookiesDoc=await getcookiesDoc();
|
||||||
if (isV3) {
|
if (isV3) {
|
||||||
// console.log(e)
|
|
||||||
skuid= await gsCfg.getBingCookie(e.user_id);
|
skuid= await gsCfg.getBingCookie(e.user_id);
|
||||||
cookie = skuid.ck;
|
cookie = skuid.ck;
|
||||||
uid = skuid.item;
|
uid = skuid.item;
|
||||||
@ -182,12 +188,12 @@ async function cookie(e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!cookie){
|
if(!cookie){
|
||||||
e.reply("cookie失效请重新绑定~")
|
e.reply("cookie失效请重新绑定~【教程】\n"+cookiesDoc)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
e.uid = uid;
|
e.uid = uid;
|
||||||
if (!cookie.includes("login_ticket")&&(isV3&&!skuid?.login_ticket)) {
|
if (!cookie.includes("login_ticket")&&(isV3&&!skuid?.login_ticket)) {
|
||||||
e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket")
|
e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 "+cookiesDoc)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let flot = (await miHoYoApi.stoken(cookie, e));
|
let flot = (await miHoYoApi.stoken(cookie, e));
|
||||||
@ -199,3 +205,11 @@ async function cookie(e) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
export async function cookiesDocHelp(e){
|
||||||
|
let cookiesDoc=await getcookiesDoc()
|
||||||
|
e.reply("【cookies帮助】"+cookiesDoc+"\ncookies必须包含login_ticket获取后请私发机器人");
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
async function getcookiesDoc(){
|
||||||
|
return await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`,"config").cookiesDoc
|
||||||
|
}
|
||||||
|
2
config/config.yaml
Normal file
2
config/config.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# cookies教程
|
||||||
|
cookiesDoc: docs.qq.com/doc/DV2tDY2ltSFdtbU9z
|
@ -46,7 +46,12 @@ class GsCfg {
|
|||||||
...this.getYaml(app, name, 'config')
|
...this.getYaml(app, name, 'config')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getfileYaml(path,name){
|
||||||
|
return YAML.parse(
|
||||||
|
fs.readFileSync(path+name+".yaml", 'utf8')
|
||||||
|
)
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 获取配置yaml
|
* 获取配置yaml
|
||||||
* @param app 功能
|
* @param app 功能
|
||||||
|
Loading…
Reference in New Issue
Block a user