mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 03:20:52 +08:00
版本号持续更新中....
This commit is contained in:
parent
e072452cd4
commit
2b11c4fecf
17
CHANGELOG.md
17
CHANGELOG.md
@ -1,8 +1,14 @@
|
|||||||
|
# 1.1.6
|
||||||
|
* 初步实现云原神签到 以及查询时间
|
||||||
|
* 通过发送token以及devId给机器人实现绑定
|
||||||
|
* 格式支持`ai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`
|
||||||
|
* 新增指令`#云原神签到`可进行云原神签到
|
||||||
|
* 新增指令`#云原神查询`可查询当前绑定token的剩余时间
|
||||||
# 1.1.5
|
# 1.1.5
|
||||||
* 体力模板列表更改为转发形式更具体呈现效果
|
* 体力模板列表更改为转发形式更具体呈现效果
|
||||||
* 新增自动签到配置
|
* 新增自动签到配置
|
||||||
*可在`xiaoyao-cvs-plugin/config/config.yaml`中修改是否启用自动签到
|
*可在`xiaoyao-cvs-plugin/config/config.yaml`中修改是否启用自动签到
|
||||||
# 1.1.3~1.1.4
|
# 1.1.2~1.1.4
|
||||||
* 新增指令`#米游币全部签到`
|
* 新增指令`#米游币全部签到`
|
||||||
*为所有存在的stoken进行社区米游币签到
|
*为所有存在的stoken进行社区米游币签到
|
||||||
* 新增指令`#米社全部签到`
|
* 新增指令`#米社全部签到`
|
||||||
@ -10,8 +16,6 @@
|
|||||||
* 新增自动签到默认**00:02**开始执行签到
|
* 新增自动签到默认**00:02**开始执行签到
|
||||||
*具体时间修改在`./config/config.yaml`
|
*具体时间修改在`./config/config.yaml`
|
||||||
* 米游社米游币获取功能需要绑定`cookies`来跑,非信任的bot请勿发送cookies
|
* 米游社米游币获取功能需要绑定`cookies`来跑,非信任的bot请勿发送cookies
|
||||||
* 实现米游社多模块签到
|
|
||||||
* 实现米游社米游币获取
|
|
||||||
* 新增指令`cookies帮助`
|
* 新增指令`cookies帮助`
|
||||||
* 新增指令`#米游社原神签到`
|
* 新增指令`#米游社原神签到`
|
||||||
* 用于获取米游社米游币
|
* 用于获取米游社米游币
|
||||||
@ -19,13 +23,12 @@
|
|||||||
* 用于签到不同的社区模块
|
* 用于签到不同的社区模块
|
||||||
* 具体有`原神、崩坏3、崩坏2、未定事件簿`
|
* 具体有`原神、崩坏3、崩坏2、未定事件簿`
|
||||||
* `大别野、崩坏星穹铁道、绝区零` 并未提供签到入口待定,后续概率补充
|
* `大别野、崩坏星穹铁道、绝区零` 并未提供签到入口待定,后续概率补充
|
||||||
# 1.1.2
|
|
||||||
* 初步实现米游社签到米游币以及社区签到
|
|
||||||
* 需要引入包文件`cnpm i promise-retry `跟`cnpm i superagent`
|
* 需要引入包文件`cnpm i promise-retry `跟`cnpm i superagent`
|
||||||
* V3版本引入文件`pnpm i promise-retry `跟`pnpm i superagent`
|
* V3版本引入文件`pnpm i promise-retry `跟`pnpm i superagent`
|
||||||
* 如果出现了安装其中一个包导致另外的包出问题的请群里询问
|
* 如果出现了安装其中一个包导致另外的包出问题的请群里询问
|
||||||
* 具体获取cookie教程后续会完善 敬情期待~
|
* 需要完整的cookie内容要包含`login_ticket`不然是无法实现米游社签到的
|
||||||
* 需要完整的cookie内容要包含`login_ticket`跟`login_uid`不然是无法实现米游社签到的
|
* 获取到的cookies发送bot后请触发一次`#mys原神签到`指令以保存`stoken`实现自动签到**(注:触发指令后无需多次获取cookies)**
|
||||||
|
* `stoken`文件数据在**xiaoyao-cvs-plugin/data/yaml/**目录下
|
||||||
|
|
||||||
# 1.1.0
|
# 1.1.0
|
||||||
* 增加`#图鉴帮助`用于查看帮助命令
|
* 增加`#图鉴帮助`用于查看帮助命令
|
||||||
|
25
apps/Note.js
25
apps/Note.js
@ -317,6 +317,9 @@ export async function DailyNoteTask() {
|
|||||||
let sendResin = 120;
|
let sendResin = 120;
|
||||||
//推送cd,12小时一次
|
//推送cd,12小时一次
|
||||||
let sendCD = 12 * 3600;
|
let sendCD = 12 * 3600;
|
||||||
|
if(isV3){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
//获取需要推送的用户
|
//获取需要推送的用户
|
||||||
for (let [user_id, cookie] of Object.entries(NoteCookie)) {
|
for (let [user_id, cookie] of Object.entries(NoteCookie)) {
|
||||||
user_id = cookie.qq || user_id;
|
user_id = cookie.qq || user_id;
|
||||||
@ -340,7 +343,7 @@ export async function DailyNoteTask() {
|
|||||||
|
|
||||||
e.reply = (msg) => {
|
e.reply = (msg) => {
|
||||||
Bot.pickUser(user_id * 1).sendMsg(msg).catch((err) => {
|
Bot.pickUser(user_id * 1).sendMsg(msg).catch((err) => {
|
||||||
logger.mark(err)
|
Bot.logger.mark(err)
|
||||||
})
|
})
|
||||||
// common.relpyPrivate(user_id, msg);
|
// common.relpyPrivate(user_id, msg);
|
||||||
};
|
};
|
||||||
@ -388,8 +391,9 @@ export async function Note_appoint(e) {
|
|||||||
let mstList = [];
|
let mstList = [];
|
||||||
let sumCount=(urlType.length/80).toFixed(0);
|
let sumCount=(urlType.length/80).toFixed(0);
|
||||||
xlmsg=sumCount-xlmsg>-1?xlmsg:sumCount;
|
xlmsg=sumCount-xlmsg>-1?xlmsg:sumCount;
|
||||||
urlType.unshift(`模板列表共,第${xlmsg}页,共${urlType.length}张,请选择序号~~\n当前支持选择的模板有:`)
|
urlType.unshift(`模板列表共,第${xlmsg}页,共${urlType.length}张,\n您可通过【#体力模板设置1】来绑定你需要的体力模板~\n请选择序号~~\n当前支持选择的模板有:`)
|
||||||
let xxmsg=(xlmsg-1)==0?0:80*(xlmsg-1)
|
let xxmsg=(xlmsg-1)==0?0:80*(xlmsg-1)
|
||||||
|
let count=0;
|
||||||
for (let [index, item] of urlType.entries()) {
|
for (let [index, item] of urlType.entries()) {
|
||||||
let msg_pass = [];
|
let msg_pass = [];
|
||||||
let imgurl;
|
let imgurl;
|
||||||
@ -404,6 +408,7 @@ export async function Note_appoint(e) {
|
|||||||
}
|
}
|
||||||
item = index + "." + item
|
item = index + "." + item
|
||||||
}
|
}
|
||||||
|
count++;
|
||||||
if(Object.keys(mstList).length==80){
|
if(Object.keys(mstList).length==80){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -420,13 +425,17 @@ export async function Note_appoint(e) {
|
|||||||
user_id: Bot.uin
|
user_id: Bot.uin
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if(xxmsg<urlType.length-1){
|
let endMsg="";
|
||||||
mstList.push({
|
if(count<urlType.length-1){
|
||||||
message: `更多内容请翻页查看\n如:#体力模板列表2`,
|
endMsg= `更多内容请翻页查看\n如:#体力模板列表2`
|
||||||
nickname: nickname,
|
}else{
|
||||||
user_id: Bot.uin
|
endMsg= `已经到底了~~`
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
mstList.push({
|
||||||
|
message: endMsg,
|
||||||
|
nickname: nickname,
|
||||||
|
user_id: Bot.uin
|
||||||
|
})
|
||||||
e.reply(await Bot.makeForwardMsg(mstList));
|
e.reply(await Bot.makeForwardMsg(mstList));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import {
|
|||||||
mysSign,
|
mysSign,
|
||||||
cookiesDocHelp,
|
cookiesDocHelp,
|
||||||
signlist,
|
signlist,
|
||||||
allMysSign,
|
allMysSign,yunSign,sendyunTime,yuntoken,
|
||||||
allSign
|
allSign
|
||||||
} from "./sign.js"
|
} from "./sign.js"
|
||||||
export {
|
export {
|
||||||
@ -38,7 +38,7 @@ export {
|
|||||||
sign,
|
sign,
|
||||||
versionInfo,
|
versionInfo,
|
||||||
Note_appoint,
|
Note_appoint,
|
||||||
pokeNote,
|
pokeNote,yunSign,sendyunTime,yuntoken,
|
||||||
cookiesDocHelp,
|
cookiesDocHelp,
|
||||||
sysCfg,
|
sysCfg,
|
||||||
help,
|
help,
|
||||||
|
836
apps/sign.js
836
apps/sign.js
@ -1,384 +1,452 @@
|
|||||||
import MihoYoApi from "../model/mys/mihoyo-api.js"
|
import MihoYoApi from "../model/mys/mihoyo-api.js"
|
||||||
import utils from '../model/mys/utils.js';
|
import utils from '../model/mys/utils.js';
|
||||||
import promiseRetry from 'promise-retry';
|
import promiseRetry from 'promise-retry';
|
||||||
import {
|
import {
|
||||||
Cfg,
|
Cfg,
|
||||||
Data
|
Data
|
||||||
} from "../components/index.js";
|
} from "../components/index.js";
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import MysInfo from '../model/mys/mysInfo.js'
|
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';
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
export const rule = {
|
import YAML from 'yaml'
|
||||||
mysSign: {
|
export const rule = {
|
||||||
reg: "^#*(米游社|mys|社区)(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零|全部)签到$",
|
mysSign: {
|
||||||
describe: "米游社米游币签到(理论上会签到全部所以区分开了)"
|
reg: "^#*(米游社|mys|社区)(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零|全部)签到$",
|
||||||
},
|
describe: "米游社米游币签到(理论上会签到全部所以区分开了)"
|
||||||
sign: {
|
},
|
||||||
reg: "^#*(崩坏3|崩坏2|未定事件簿)签到$",
|
sign: {
|
||||||
describe: "米社规则签到"
|
reg: "^#*(崩坏3|崩坏2|未定事件簿)签到$",
|
||||||
},
|
describe: "米社规则签到"
|
||||||
signlist: {
|
},
|
||||||
reg: "^#(米游币|米社)全部签到$",
|
signlist: {
|
||||||
describe: "米游币全部签到"
|
reg: "^#(米游币|米社)全部签到$",
|
||||||
},
|
describe: "米游币全部签到"
|
||||||
// allMysSign: {
|
},
|
||||||
// reg: "^#米游币全部签到$",
|
sendyunTime: {
|
||||||
// describe: "米游币全部签到"
|
reg: "^#*云原神(时间|剩余时间|剩余|还有多久|还剩多少分钟|查询)$",
|
||||||
// },
|
describe: "米游币全部签到"
|
||||||
// allSign: {
|
},
|
||||||
// reg: "^#米社全部签到$",
|
yunSign: {
|
||||||
// describe: "米社全部签到"
|
reg: "^#*云原神签到$",
|
||||||
// },
|
describe: "云原神签到"
|
||||||
cookiesDocHelp: {
|
},
|
||||||
reg: "^#*(米游社|cookies|米游币)帮助$",
|
yuntoken:{
|
||||||
describe: "cookies获取帮助"
|
reg: "^(.*)ct(.*)$",
|
||||||
}
|
describe: "云原神签到"
|
||||||
};
|
},
|
||||||
|
cookiesDocHelp: {
|
||||||
const _path = process.cwd();
|
reg: "^#*(米游社|cookies|米游币)帮助$",
|
||||||
let START = moment().unix();
|
describe: "cookies获取帮助"
|
||||||
const TODAY_DATE = moment().format('YYYY-MM-DD');
|
}
|
||||||
const RETRY_OPTIONS = {
|
};
|
||||||
retries: 3,
|
|
||||||
minTimeout: 5000,
|
const _path = process.cwd();
|
||||||
maxTimeout: 10000
|
let START = moment().unix();
|
||||||
};
|
const TODAY_DATE = moment().format('YYYY-MM-DD');
|
||||||
let YamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
const RETRY_OPTIONS = {
|
||||||
export async function sign(e) {
|
retries: 3,
|
||||||
let {
|
minTimeout: 5000,
|
||||||
skuid,
|
maxTimeout: 10000
|
||||||
cookie
|
};
|
||||||
} = await getCookie(e);
|
let YamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
||||||
if (!cookie) {
|
export async function sign(e) {
|
||||||
e.reply("请先绑定cookie~\n发送【cookie帮助】获取教程")
|
let {
|
||||||
return true;
|
skuid,
|
||||||
}
|
cookie
|
||||||
|
} = await getCookie(e);
|
||||||
START = moment().unix();
|
if (!cookie) {
|
||||||
let miHoYoApi = new MihoYoApi(e);
|
e.reply("请先绑定cookie~\n发送【cookie帮助】获取教程")
|
||||||
let resultMessage = "";
|
return true;
|
||||||
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
|
}
|
||||||
let ForumData = await getDataList(msg);
|
|
||||||
e.reply(`开始尝试${msg}签到预计${msg=='全部'?"60":"5-10"}秒~`)
|
START = moment().unix();
|
||||||
for (let forum of ForumData) {
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
if (!(["崩坏3", "崩坏2", "未定事件簿"].includes(forum.name))) {
|
let resultMessage = "";
|
||||||
continue;
|
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
|
||||||
}
|
let ForumData = await getDataList(msg);
|
||||||
resultMessage += `**${forum.name}**\n`
|
e.reply(`开始尝试${msg}签到预计${msg=='全部'?"60":"5-10"}秒~`)
|
||||||
try {
|
for (let forum of ForumData) {
|
||||||
// 1 BBS Sign
|
if (!(["崩坏3", "崩坏2", "未定事件簿"].includes(forum.name))) {
|
||||||
let resObj = await promiseRetry((retry, number) => {
|
continue;
|
||||||
// Bot.logger.info(`开始签到: [${forum.name}] 尝试次数: ${number}`);
|
}
|
||||||
return miHoYoApi.honkai3rdSignTask(forum.name).catch((e) => {
|
resultMessage += `**${forum.name}**\n`
|
||||||
Bot.logger.error(`${forum.name} 签到失败: [${e.message}] 尝试次数: ${number}`);
|
try {
|
||||||
return retry(e);
|
// 1 BBS Sign
|
||||||
});
|
let resObj = await promiseRetry((retry, number) => {
|
||||||
}, RETRY_OPTIONS);
|
// Bot.logger.info(`开始签到: [${forum.name}] 尝试次数: ${number}`);
|
||||||
Bot.logger.info(`${forum.name} 签到结果: [${resObj.message}]`);
|
return miHoYoApi.honkai3rdSignTask(forum.name).catch((e) => {
|
||||||
resultMessage += `签到: [${resObj.message}]\n`;
|
Bot.logger.error(`${forum.name} 签到失败: [${e.message}] 尝试次数: ${number}`);
|
||||||
} catch (e) {
|
return retry(e);
|
||||||
Bot.logger.error(`${forum.name} 签到失败 [${e.message}]`);
|
});
|
||||||
resultMessage += `签到失败: [${e.message}]\n`;
|
}, RETRY_OPTIONS);
|
||||||
}
|
Bot.logger.info(`${forum.name} 签到结果: [${resObj.message}]`);
|
||||||
|
resultMessage += `签到: [${resObj.message}]\n`;
|
||||||
await utils.randomSleepAsync();
|
} catch (e) {
|
||||||
}
|
Bot.logger.error(`${forum.name} 签到失败 [${e.message}]`);
|
||||||
await replyMsg(e, resultMessage);
|
resultMessage += `签到失败: [${e.message}]\n`;
|
||||||
return true
|
}
|
||||||
}
|
|
||||||
export async function mysSign(e) {
|
await utils.randomSleepAsync();
|
||||||
let isck = await cookie(e);
|
}
|
||||||
if (!isck) {
|
await replyMsg(e, resultMessage);
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
let iscount = "";
|
export async function mysSign(e) {
|
||||||
let miHoYoApi = new MihoYoApi(e);
|
let isck = await cookie(e);
|
||||||
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length == 0) {
|
if (!isck) {
|
||||||
e.reply("未读取到stoken请检查cookies是否包含login_ticket、以及云崽是否为最新版本V3、V2兼容")
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
let iscount = "";
|
||||||
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
START = moment().unix();
|
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length == 0) {
|
||||||
let resultMessage = "";
|
e.reply("未读取到stoken请检查cookies是否包含login_ticket、以及云崽是否为最新版本V3、V2兼容")
|
||||||
// Execute task
|
return true;
|
||||||
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
|
}
|
||||||
let ForumData = await getDataList(msg);
|
|
||||||
e.reply(`开始尝试${msg}社区签到预计${msg=='全部'?"10-20":"1-3"}分钟~`)
|
START = moment().unix();
|
||||||
for (let forum of ForumData) {
|
let resultMessage = "";
|
||||||
resultMessage += `**${forum.name}**\n`
|
// Execute task
|
||||||
try {
|
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
|
||||||
// 1 BBS Sign
|
let ForumData = await getDataList(msg);
|
||||||
let resObj = await promiseRetry((retry, number) => {
|
e.reply(`开始尝试${msg}社区签到预计${msg=='全部'?"10-20":"1-3"}分钟~`)
|
||||||
// Bot.logger.info(`开始签到: [${forum.name}] 尝试次数: ${number}`);
|
for (let forum of ForumData) {
|
||||||
return miHoYoApi.forumSign(forum.forumId).catch((e) => {
|
resultMessage += `**${forum.name}**\n`
|
||||||
Bot.logger.error(`${forum.name} 签到失败: [${e.message}] 尝试次数: ${number}`);
|
try {
|
||||||
return retry(e);
|
// 1 BBS Sign
|
||||||
});
|
let resObj = await promiseRetry((retry, number) => {
|
||||||
}, RETRY_OPTIONS);
|
// Bot.logger.info(`开始签到: [${forum.name}] 尝试次数: ${number}`);
|
||||||
Bot.logger.info(`${forum.name} 签到结果: [${resObj.message}]`);
|
return miHoYoApi.forumSign(forum.forumId).catch((e) => {
|
||||||
resultMessage += `签到: [${resObj.message}]\n`;
|
Bot.logger.error(`${forum.name} 签到失败: [${e.message}] 尝试次数: ${number}`);
|
||||||
} catch (e) {
|
return retry(e);
|
||||||
Bot.logger.error(`${forum.name} 签到失败 [${e.message}]`);
|
});
|
||||||
resultMessage += `签到失败: [${e.message}]\n`;
|
}, RETRY_OPTIONS);
|
||||||
}
|
Bot.logger.info(`${forum.name} 签到结果: [${resObj.message}]`);
|
||||||
await utils.randomSleepAsync();
|
resultMessage += `签到: [${resObj.message}]\n`;
|
||||||
}
|
} catch (e) {
|
||||||
for (let forum of ForumData) {
|
Bot.logger.error(`${forum.name} 签到失败 [${e.message}]`);
|
||||||
resultMessage += `\n**${forum.name}**\n`
|
resultMessage += `签到失败: [${e.message}]\n`;
|
||||||
try {
|
}
|
||||||
// 2 BBS list post
|
await utils.randomSleepAsync();
|
||||||
let resObj = await promiseRetry((retry, number) => {
|
}
|
||||||
// Bot.logger.info(`读取帖子列表: [${forum.name}] 尝试次数: ${number}`);
|
for (let forum of ForumData) {
|
||||||
return miHoYoApi.forumPostList(forum.forumId).catch((e) => {
|
resultMessage += `\n**${forum.name}**\n`
|
||||||
Bot.logger.error(`${forum.name} 读取帖子列表失败: [${e.message}] 尝试次数: ${number}`);
|
try {
|
||||||
return retry(e);
|
// 2 BBS list post
|
||||||
});
|
let resObj = await promiseRetry((retry, number) => {
|
||||||
}, RETRY_OPTIONS);
|
// Bot.logger.info(`读取帖子列表: [${forum.name}] 尝试次数: ${number}`);
|
||||||
Bot.logger.info(`${forum.name} 读取列表成功 [${resObj.message}],读取到 [${resObj.data.list.length}] 条记录`);
|
return miHoYoApi.forumPostList(forum.forumId).catch((e) => {
|
||||||
|
Bot.logger.error(`${forum.name} 读取帖子列表失败: [${e.message}] 尝试次数: ${number}`);
|
||||||
let postList = resObj.data.list;
|
return retry(e);
|
||||||
for (let post of postList) {
|
});
|
||||||
post = post.post;
|
}, RETRY_OPTIONS);
|
||||||
// 2.1 BBS read post
|
Bot.logger.info(`${forum.name} 读取列表成功 [${resObj.message}],读取到 [${resObj.data.list.length}] 条记录`);
|
||||||
let resObj = await promiseRetry((retry, number) => {
|
|
||||||
// Bot.logger.info(`读取帖子: [${post.subject}] 尝试次数: ${number}`);
|
let postList = resObj.data.list;
|
||||||
return miHoYoApi.forumPostDetail(post['post_id']).catch((e) => {
|
for (let post of postList) {
|
||||||
Bot.logger.error(`${forum.name} 读取帖子失败: [${e.message}] 尝试次数: ${number}`);
|
post = post.post;
|
||||||
return retry(e);
|
// 2.1 BBS read post
|
||||||
});
|
let resObj = await promiseRetry((retry, number) => {
|
||||||
}, RETRY_OPTIONS);
|
// Bot.logger.info(`读取帖子: [${post.subject}] 尝试次数: ${number}`);
|
||||||
// Bot.logger.info(`${forum.name} [${post.subject}] 读取成功 [${resObj.message}]`);
|
return miHoYoApi.forumPostDetail(post['post_id']).catch((e) => {
|
||||||
await utils.randomSleepAsync();
|
Bot.logger.error(`${forum.name} 读取帖子失败: [${e.message}] 尝试次数: ${number}`);
|
||||||
// 2.2 BBS vote post
|
return retry(e);
|
||||||
resObj = await promiseRetry((retry, number) => {
|
});
|
||||||
// Bot.logger.info(`点赞帖子: [${post.subject}] 尝试次数: ${number}`);
|
}, RETRY_OPTIONS);
|
||||||
return miHoYoApi.forumPostVote(post['post_id']).catch((e) => {
|
// Bot.logger.info(`${forum.name} [${post.subject}] 读取成功 [${resObj.message}]`);
|
||||||
Bot.logger.error(`${forum.name} 点赞帖子失败: [${e.message}] 尝试次数: ${number}`);
|
await utils.randomSleepAsync();
|
||||||
return retry(e);
|
// 2.2 BBS vote post
|
||||||
});
|
resObj = await promiseRetry((retry, number) => {
|
||||||
}, RETRY_OPTIONS);
|
// Bot.logger.info(`点赞帖子: [${post.subject}] 尝试次数: ${number}`);
|
||||||
|
return miHoYoApi.forumPostVote(post['post_id']).catch((e) => {
|
||||||
// Bot.logger.info(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`);
|
Bot.logger.error(`${forum.name} 点赞帖子失败: [${e.message}] 尝试次数: ${number}`);
|
||||||
await utils.randomSleepAsync();
|
return retry(e);
|
||||||
}
|
});
|
||||||
|
}, RETRY_OPTIONS);
|
||||||
// 2.3 BBS share post
|
|
||||||
let sharePost = postList[0].post;
|
// Bot.logger.info(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`);
|
||||||
resObj = await promiseRetry((retry, number) => {
|
await utils.randomSleepAsync();
|
||||||
// Bot.logger.info(`分享帖子: [${sharePost.subject}] 尝试次数: ${number}`);
|
}
|
||||||
return miHoYoApi.forumPostShare(sharePost['post_id']).catch((e) => {
|
|
||||||
Bot.logger.error(`${forum.name} 分享帖子失败: [${e.message}] 尝试次数: ${number}`);
|
// 2.3 BBS share post
|
||||||
return retry(e);
|
let sharePost = postList[0].post;
|
||||||
});
|
resObj = await promiseRetry((retry, number) => {
|
||||||
}, RETRY_OPTIONS);
|
// Bot.logger.info(`分享帖子: [${sharePost.subject}] 尝试次数: ${number}`);
|
||||||
} catch (e) {
|
return miHoYoApi.forumPostShare(sharePost['post_id']).catch((e) => {
|
||||||
Bot.logger.error(`${forum.name} 读帖点赞分享失败 [${e.message}]`);
|
Bot.logger.error(`${forum.name} 分享帖子失败: [${e.message}] 尝试次数: ${number}`);
|
||||||
resultMessage += `读帖点赞分享: 失败 [${e.message}]\n`;
|
return retry(e);
|
||||||
}
|
});
|
||||||
resultMessage += `读帖点赞分享: 成功\n`;
|
}, RETRY_OPTIONS);
|
||||||
await utils.randomSleepAsync();
|
} catch (e) {
|
||||||
}
|
Bot.logger.error(`${forum.name} 读帖点赞分享失败 [${e.message}]`);
|
||||||
await replyMsg(e, resultMessage);
|
resultMessage += `读帖点赞分享: 失败 [${e.message}]\n`;
|
||||||
return true
|
}
|
||||||
}
|
resultMessage += `读帖点赞分享: 成功\n`;
|
||||||
|
await utils.randomSleepAsync();
|
||||||
async function replyMsg(e, resultMessage) {
|
}
|
||||||
const END = moment().unix();
|
await replyMsg(e, resultMessage);
|
||||||
Bot.logger.info(`运行结束, 用时 ${END - START} 秒`);
|
return true
|
||||||
resultMessage += `\n用时 ${END - START} 秒`;
|
}
|
||||||
e.reply(resultMessage);
|
|
||||||
}
|
async function replyMsg(e, resultMessage) {
|
||||||
|
const END = moment().unix();
|
||||||
async function getDataList(name) {
|
Bot.logger.info(`运行结束, 用时 ${END - START} 秒`);
|
||||||
let ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys")
|
resultMessage += `\n用时 ${END - START} 秒`;
|
||||||
for (let item of ForumData) {
|
e.reply(resultMessage);
|
||||||
if (item.name == name) { //循环结束未找到的时候返回原数组签到全部
|
}
|
||||||
return [item]
|
|
||||||
}
|
async function getDataList(name) {
|
||||||
}
|
let ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys")
|
||||||
return ForumData;
|
for (let item of ForumData) {
|
||||||
}
|
if (item.name == name) { //循环结束未找到的时候返回原数组签到全部
|
||||||
|
return [item]
|
||||||
async function cookie(e) {
|
}
|
||||||
let {
|
}
|
||||||
cookie,
|
return ForumData;
|
||||||
uid,skuid
|
}
|
||||||
} = await getCookie(e);
|
|
||||||
let miHoYoApi = new MihoYoApi(e);
|
async function cookie(e) {
|
||||||
let cookiesDoc = await getcookiesDoc();
|
let {
|
||||||
|
cookie,
|
||||||
if (!cookie) {
|
uid,skuid
|
||||||
e.reply("cookie失效请重新绑定~【教程】\n" + cookiesDoc)
|
} = await getCookie(e);
|
||||||
return false;
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
}
|
let cookiesDoc = await getcookiesDoc();
|
||||||
|
|
||||||
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length != 0) {
|
if (!cookie) {
|
||||||
return true;
|
e.reply("cookie失效请重新绑定~【教程】\n" + cookiesDoc)
|
||||||
}
|
return false;
|
||||||
if (!cookie.includes("login_ticket") && (isV3 && !skuid?.login_ticket)) {
|
}
|
||||||
e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 " + cookiesDoc)
|
|
||||||
return false;
|
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length != 0) {
|
||||||
}
|
return true;
|
||||||
let flot = (await miHoYoApi.stoken(cookie, e));
|
}
|
||||||
// console.log(flot)
|
if (!cookie.includes("login_ticket") && (isV3 && !skuid?.login_ticket)) {
|
||||||
await utils.sleepAsync(1000); //延迟加载防止文件未生成
|
e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 " + cookiesDoc)
|
||||||
if (!flot) {
|
return false;
|
||||||
e.reply("登录失效请重新登录获取cookie发送机器人~")
|
}
|
||||||
return false;
|
let flot = (await miHoYoApi.stoken(cookie, e));
|
||||||
}
|
// console.log(flot)
|
||||||
return true;
|
await utils.sleepAsync(1000); //延迟加载防止文件未生成
|
||||||
}
|
if (!flot) {
|
||||||
async function getCookie(e) {
|
e.reply("登录失效请重新登录获取cookie发送机器人~")
|
||||||
let skuid, cookie, uid
|
return false;
|
||||||
if (isV3) {
|
}
|
||||||
skuid = await gsCfg.getBingCookie(e.user_id);
|
return true;
|
||||||
cookie = skuid.ck;
|
}
|
||||||
uid = skuid.item;
|
async function getCookie(e) {
|
||||||
} else {
|
let skuid, cookie, uid
|
||||||
if (NoteCookie[e.user_id]) {
|
if (isV3) {
|
||||||
cookie = NoteCookie[e.user_id].cookie;
|
skuid = await gsCfg.getBingCookie(e.user_id);
|
||||||
uid = NoteCookie[e.user_id].uid;
|
cookie = skuid.ck;
|
||||||
skuid = NoteCookie[e.user_id];
|
uid = skuid.item;
|
||||||
} else if (BotConfig.dailyNote && BotConfig.dailyNote[e.user_id]) {
|
} else {
|
||||||
cookie = BotConfig.dailyNote[e.user_id].cookie;
|
if (NoteCookie[e.user_id]) {
|
||||||
uid = BotConfig.dailyNote[e.user_id].uid;
|
cookie = NoteCookie[e.user_id].cookie;
|
||||||
skuid = BotConfig.NoteCookie[e.user_id];
|
uid = NoteCookie[e.user_id].uid;
|
||||||
}
|
skuid = NoteCookie[e.user_id];
|
||||||
}
|
} else if (BotConfig.dailyNote && BotConfig.dailyNote[e.user_id]) {
|
||||||
e.uid = uid;
|
cookie = BotConfig.dailyNote[e.user_id].cookie;
|
||||||
e.cookie = cookie;
|
uid = BotConfig.dailyNote[e.user_id].uid;
|
||||||
return {
|
skuid = BotConfig.NoteCookie[e.user_id];
|
||||||
cookie,
|
}
|
||||||
uid,
|
}
|
||||||
skuid
|
e.uid = uid;
|
||||||
}
|
e.cookie = cookie;
|
||||||
}
|
return {
|
||||||
export async function cookiesDocHelp(e) {
|
cookie,
|
||||||
let cookiesDoc = await getcookiesDoc()
|
uid,
|
||||||
e.reply("【cookies帮助】" + cookiesDoc + "\ncookies必须包含login_ticket获取后请私发机器人");
|
skuid
|
||||||
return true
|
}
|
||||||
}
|
}
|
||||||
async function getcookiesDoc() {
|
export async function cookiesDocHelp(e) {
|
||||||
return await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").cookiesDoc
|
let cookiesDoc = await getcookiesDoc()
|
||||||
}
|
e.reply("【cookies帮助】" + cookiesDoc + "\ncookies必须包含login_ticket获取后请私发机器人");
|
||||||
//定时米社米币签到任务
|
return true
|
||||||
export async function allMysSign() {
|
}
|
||||||
Bot.logger.mark(`开始米社米币签到任务`);
|
async function getcookiesDoc() {
|
||||||
let stoken = await gsCfg.getBingStoken();
|
return await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").cookiesDoc
|
||||||
let isPushSign = await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").isPushSign
|
}
|
||||||
//获取需要签到的用户
|
//定时米社米币签到任务
|
||||||
for (let data of stoken) {
|
export async function allMysSign() {
|
||||||
let user_id = data.qq;
|
Bot.logger.mark(`开始米社米币签到任务`);
|
||||||
Bot.logger.mark(`正在为qq${user_id}签到`);
|
let stoken = await gsCfg.getBingStoken();
|
||||||
let e = {
|
let isPushSign = await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").isPushSign
|
||||||
user_id,
|
//获取需要签到的用户
|
||||||
isTask: true
|
for (let data of stoken) {
|
||||||
};
|
let user_id = data.qq;
|
||||||
e.cookie = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
Bot.logger.mark(`正在为qq${user_id}签到`);
|
||||||
e.msg = "全部"
|
let e = {
|
||||||
//已签到不重复执行
|
user_id,
|
||||||
let key = `genshin:mys:signed_bbs:${user_id}`;
|
isTask: true
|
||||||
if (await redis.get(key)) {
|
};
|
||||||
continue;
|
e.cookie = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
||||||
}
|
e.msg = "全部"
|
||||||
|
//已签到不重复执行
|
||||||
e.reply = (msg) => {
|
let key = `genshin:mys:signed_bbs:${user_id}`;
|
||||||
//关闭签到消息推送
|
if (await redis.get(key)) {
|
||||||
if (!isPushSign||ismysbool) {
|
continue;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
if (msg.includes("签到成功") && (cookie.isSignPush === true || cookie.isSignPush === undefined)) {
|
e.reply = (msg) => {
|
||||||
// msg = msg.replace("签到成功", "自动签到成功");
|
//关闭签到消息推送
|
||||||
utils.relpyPrivate(user_id, msg + "\n自动签到成功");
|
if (!isPushSign||ismysbool) {
|
||||||
}
|
return;
|
||||||
};
|
}
|
||||||
|
if (msg.includes("签到成功") && (cookie.isSignPush === true || cookie.isSignPush === undefined)) {
|
||||||
await mysSign(e);
|
// msg = msg.replace("签到成功", "自动签到成功");
|
||||||
await utils.sleepAsync(10000);
|
utils.relpyPrivate(user_id, msg + "\n自动签到成功");
|
||||||
}
|
}
|
||||||
Bot.logger.mark(`签到任务完成`);
|
};
|
||||||
return true
|
|
||||||
}
|
await mysSign(e);
|
||||||
|
await utils.sleepAsync(10000);
|
||||||
//定时签到任务
|
}
|
||||||
export async function allSign() {
|
Bot.logger.mark(`签到任务完成`);
|
||||||
Bot.logger.mark(`开始米社签到任务`);
|
return true
|
||||||
let isAllSign = await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").isAllSign
|
}
|
||||||
let userIdList = [];
|
|
||||||
if (isV3) {
|
//定时签到任务
|
||||||
let dir = './data/MysCookie/'
|
export async function allSign() {
|
||||||
let files = fs.readdirSync(dir).filter(file => file.endsWith('.yaml'))
|
Bot.logger.mark(`开始米社签到任务`);
|
||||||
userIdList = (files.join(",").replace(/.yaml/g, "").split(","))
|
let isAllSign = await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").isAllSign
|
||||||
} else {
|
let userIdList = [];
|
||||||
for (let [user_id, cookie] of Object.entries(NoteCookie)) {
|
if (isV3) {
|
||||||
userIdList.push(user_id)
|
let dir = './data/MysCookie/'
|
||||||
}
|
let files = fs.readdirSync(dir).filter(file => file.endsWith('.yaml'))
|
||||||
}
|
userIdList = (files.join(",").replace(/.yaml/g, "").split(","))
|
||||||
for (let qq of userIdList) {
|
} else {
|
||||||
let user_id = qq;
|
for (let [user_id, cookie] of Object.entries(NoteCookie)) {
|
||||||
let e = {
|
userIdList.push(user_id)
|
||||||
user_id,
|
}
|
||||||
qq,
|
}
|
||||||
isTask: true
|
for (let qq of userIdList) {
|
||||||
};
|
let user_id = qq;
|
||||||
e.msg = "全部"
|
let e = {
|
||||||
e.reply = (msg) => {
|
user_id,
|
||||||
if (!msg.includes("OK")) {
|
qq,
|
||||||
return;
|
isTask: true
|
||||||
}
|
};
|
||||||
if (!isAllSign||isbool) {
|
e.msg = "全部"
|
||||||
return;
|
e.reply = (msg) => {
|
||||||
}
|
if (!msg.includes("OK")) {
|
||||||
if (msg.includes("签到成功") && (cookie.isSignPush === true || cookie.isSignPush === undefined)) {
|
return;
|
||||||
utils.relpyPrivate(qq, msg + "\n自动签到成功");
|
}
|
||||||
}
|
if (!isAllSign||isbool) {
|
||||||
};
|
return;
|
||||||
await sign(e);
|
}
|
||||||
await utils.sleepAsync(10000);
|
if (msg.includes("签到成功") && (cookie.isSignPush === true || cookie.isSignPush === undefined)) {
|
||||||
}
|
utils.relpyPrivate(qq, msg + "\n自动签到成功");
|
||||||
Bot.logger.mark(`签到任务完成`);
|
}
|
||||||
}
|
};
|
||||||
const checkAuth = async function(e) {
|
await sign(e);
|
||||||
return await e.checkAuth({
|
await utils.sleepAsync(10000);
|
||||||
auth: "master",
|
}
|
||||||
replyMsg: `只有主人才能命令我哦~
|
Bot.logger.mark(`签到任务完成`);
|
||||||
(*/ω\*)`
|
}
|
||||||
});
|
const checkAuth = async function(e) {
|
||||||
}
|
return await e.checkAuth({
|
||||||
let isbool = false;
|
auth: "master",
|
||||||
let ismysbool = false;
|
replyMsg: `只有主人才能命令我哦~
|
||||||
export async function signlist(e) {
|
(*/ω\*)`
|
||||||
if (!await checkAuth(e)) {
|
});
|
||||||
return true;
|
}
|
||||||
}
|
let isbool = false;
|
||||||
if (isbool) {
|
let ismysbool = false;
|
||||||
e.reply(`米社签到中请勿重复执行`)
|
export async function signlist(e) {
|
||||||
return true;
|
if (!await checkAuth(e)) {
|
||||||
}
|
return true;
|
||||||
if (ismysbool) {
|
}
|
||||||
e.reply(`米游币签到中请勿重复执行`)
|
if (isbool) {
|
||||||
return true;
|
e.reply(`米社签到中请勿重复执行`)
|
||||||
}
|
return true;
|
||||||
let msg = e.msg.replace(/#|全部签到/g, "")
|
}
|
||||||
e.reply(`开始执行${msg}签到中,请勿重复执行`);
|
if (ismysbool) {
|
||||||
if (msg == "米游币") {
|
e.reply(`米游币签到中请勿重复执行`)
|
||||||
if(!fs.existsSync(YamlDataUrl)){
|
return true;
|
||||||
Data.createDir("", YamlDataUrl, false);
|
}
|
||||||
e.reply("未读取到可签到文件")
|
let msg = e.msg.replace(/#|全部签到/g, "")
|
||||||
return true;
|
e.reply(`开始执行${msg}签到中,请勿重复执行`);
|
||||||
}
|
if (msg == "米游币") {
|
||||||
ismysbool=true;
|
if(!fs.existsSync(YamlDataUrl)){
|
||||||
await allMysSign()
|
Data.createDir("", YamlDataUrl, false);
|
||||||
} else {
|
e.reply("未读取到可签到文件")
|
||||||
isbool = true;
|
return true;
|
||||||
await allSign()
|
}
|
||||||
}
|
ismysbool=true;
|
||||||
e.reply(`${msg}签到任务已完成`);
|
await allMysSign()
|
||||||
ismysbool=false;
|
} else {
|
||||||
isbool = false;
|
isbool = true;
|
||||||
return true;
|
await allSign()
|
||||||
}
|
}
|
||||||
|
e.reply(`${msg}签到任务已完成`);
|
||||||
|
ismysbool=false;
|
||||||
|
isbool = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let yunpath=`${_path}/plugins/xiaoyao-cvs-plugin/data/yunToken/`;
|
||||||
|
init()
|
||||||
|
function init() {
|
||||||
|
Data.createDir("",yunpath , false);
|
||||||
|
}
|
||||||
|
export async function yunSign(e){
|
||||||
|
if(!(await getyunToken(e))){
|
||||||
|
e.reply("尚未绑定云原神token")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
|
e.reply((await miHoYoApi.yunGenshen()).sendMSg)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const getyunToken=async function(e){
|
||||||
|
let file = `${yunpath}/${e.user_id}.yaml`
|
||||||
|
try {
|
||||||
|
let ck = fs.readFileSync(file, 'utf-8')
|
||||||
|
ck = YAML.parse(ck)
|
||||||
|
e.devId=ck.devId;
e.yuntoken=ck.yuntoken;
|
||||||
|
return ck
|
||||||
|
} catch (error) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export async function sendyunTime(e){
|
||||||
|
if(!(await getyunToken(e))){
|
||||||
|
e.reply("尚未绑定云原神token")
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
|
e.reply((await miHoYoApi.logyunGenshen()).log_msg)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
export async function yuntoken(e){
|
||||||
|
console.log(e)
|
||||||
|
if (["ct","si","devId"].includes(e.msg)) {
|
||||||
|
e.reply(`格式支持\nai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let msg=e.msg.split("devId")
|
||||||
|
let devId=msg[1].replace(/=/,"")
|
||||||
|
let yuntoken=msg[0];
|
||||||
|
e.devId=devId;
|
||||||
|
e.yuntoken=yuntoken;
|
||||||
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
|
let objData=(await miHoYoApi.logyunGenshen()) //校验token是否有效
|
||||||
|
if(objData.retcode!=0){
|
||||||
|
e.reply(objData.message)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let datalist = {
|
||||||
|
devId: devId,
|
||||||
|
yuntoken: yuntoken,
|
||||||
|
qq: e.user_id,
|
||||||
|
uid: e.uid,
|
||||||
|
sign: true
|
||||||
|
}
|
||||||
|
let yamlStr = YAML.stringify(datalist);
|
||||||
|
fs.writeFileSync(`${yunpath}${e.user_id}.yaml`, yamlStr, 'utf8');
|
||||||
|
e.reply("云原神cookie保存成功~\n您后续可发送【#云原神查询】获取使用时间~")
|
||||||
|
return true;
|
||||||
|
}
|
@ -84,6 +84,8 @@ export default class MihoYoApi {
|
|||||||
this.e = e
|
this.e = e
|
||||||
this.cookie = e.cookie
|
this.cookie = e.cookie
|
||||||
this.userId = String(e.user_id)
|
this.userId = String(e.user_id)
|
||||||
|
this.yuntoken=e.yuntoken
|
||||||
|
this.devId=e.devId
|
||||||
// //初始化配置文件
|
// //初始化配置文件
|
||||||
let data = this.getStoken(this.e.user_id);
|
let data = this.getStoken(this.e.user_id);
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -209,13 +211,47 @@ export default class MihoYoApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async yunGenshen() {
|
async yunGenshen() {
|
||||||
const url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/login`;
|
let url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/login`;
|
||||||
let res = await superagent.post(url).set(this.getyunHeader()).timeout(10000);
|
let res = await superagent.post(url).set(this.getyunHeader()).timeout(10000);
|
||||||
url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get`;
|
let sendMSg = "";
|
||||||
|
let log_msg=(await this.logyunGenshen()).log_msg
|
||||||
|
sendMSg += log_msg
|
||||||
|
Bot.logger.info(log_msg)
|
||||||
|
url =
|
||||||
|
`https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/listNotifications?status=NotificationStatusUnread&type=NotificationTypePopup&is_sort=true`;
|
||||||
res = await superagent.get(url).set(this.getyunHeader()).timeout(10000);
|
res = await superagent.get(url).set(this.getyunHeader()).timeout(10000);
|
||||||
|
let resObj = JSON.parse(res.text);
|
||||||
|
let list = resObj.data.list;
|
||||||
|
if(Object.keys(list).length==0){
|
||||||
|
resObj.sendMSg="您今天的奖励已经领取了啦~";
|
||||||
|
return resObj;
|
||||||
|
}
|
||||||
|
for (let item of list) {
|
||||||
|
let reward_id = item.id;
|
||||||
|
let reward_msg = item.msg;
|
||||||
|
url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification`;
|
||||||
|
res = await superagent.post(url).set(this.getyunHeader()).send({"id": reward_id}).timeout(10000);
|
||||||
|
let log_msg=`\n领取奖励,ID:${reward_id},Msg:${reward_msg}`;
|
||||||
|
Bot.logger.info(log_msg)
|
||||||
|
sendMSg+=log_msg
|
||||||
|
}
|
||||||
|
log_msg="\n\n"+(await this.logyunGenshen()).log_msg
|
||||||
|
sendMSg += log_msg
|
||||||
|
resObj.sendMSg=sendMSg;
|
||||||
|
Bot.logger.info(log_msg)
|
||||||
|
return resObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async logyunGenshen(){
|
||||||
|
let url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get`;
|
||||||
|
let res = await superagent.get(url).set(this.getyunHeader()).timeout(10000);
|
||||||
|
let resObj = JSON.parse(res.text);
|
||||||
|
let data = resObj.data
|
||||||
|
let log_msg=`米云币:${data?.coin?.coin_num},免费时长:${data?.free_time?.free_time}分钟,总时长:${data.total_time}分钟`;
|
||||||
|
resObj.log_msg=log_msg
|
||||||
|
return resObj
|
||||||
|
}
|
||||||
|
|
||||||
async stoken(cookie, e) {
|
async stoken(cookie, e) {
|
||||||
this.e = e;
|
this.e = e;
|
||||||
if (Object.keys(this.getStoken(e.user_id)).length != 0) {
|
if (Object.keys(this.getStoken(e.user_id)).length != 0) {
|
||||||
@ -312,12 +348,12 @@ export default class MihoYoApi {
|
|||||||
//云原神签到头
|
//云原神签到头
|
||||||
getyunHeader() {
|
getyunHeader() {
|
||||||
return {
|
return {
|
||||||
"x-rpc-combo_token": token, //这里填你的ck
|
"x-rpc-combo_token": this.yuntoken, //这里填你的ck
|
||||||
"x-rpc-client_type": "2",
|
"x-rpc-client_type": "2",
|
||||||
"x-rpc-app_version": "1.3.0",
|
"x-rpc-app_version": "1.3.0",
|
||||||
"x-rpc-sys_version": "11",
|
"x-rpc-sys_version": "11",
|
||||||
"x-rpc-channel": "mihoyo",
|
"x-rpc-channel": "mihoyo",
|
||||||
"x-rpc-device_id": device_id, //这里填获取到的设备Id
|
"x-rpc-device_id": this.devId, //这里填获取到的设备Id
|
||||||
"x-rpc-device_name": "Xiaomi Mi 10 Pro",
|
"x-rpc-device_name": "Xiaomi Mi 10 Pro",
|
||||||
"x-rpc-device_model": "Mi 10 Pro",
|
"x-rpc-device_model": "Mi 10 Pro",
|
||||||
"x-rpc-app_id": "1953439974",
|
"x-rpc-app_id": "1953439974",
|
||||||
@ -387,7 +423,7 @@ export default class MihoYoApi {
|
|||||||
url = `${web_api}/event/luna/sign`
|
url = `${web_api}/event/luna/sign`
|
||||||
}
|
}
|
||||||
url += `?region=${region}&act_id=${board.actid}&uid=${game_uid}`
|
url += `?region=${region}&act_id=${board.actid}&uid=${game_uid}`
|
||||||
let res= await superagent.post(url).set(this.getpubHeaders(board)).timeout(10000);
|
let res = await superagent.post(url).set(this.getpubHeaders(board)).timeout(10000);
|
||||||
let resObj = JSON.parse(res.text);
|
let resObj = JSON.parse(res.text);
|
||||||
return resObj
|
return resObj
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user