mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2025-01-22 22:11:22 +08:00
修正米游币签到逻辑补充米币任务数据
This commit is contained in:
parent
066c2b5314
commit
6fdbe44f0e
@ -1,5 +1,8 @@
|
|||||||
|
# 1.1.7
|
||||||
|
* 新增指令`#米币查询`
|
||||||
|
* 新增`道具图鉴`图鉴数据
|
||||||
|
* 修正米游币签到逻辑
|
||||||
# 1.1.6
|
# 1.1.6
|
||||||
* 初步实现云原神签到 以及查询时间
|
|
||||||
* 通过发送token以及devId给机器人实现绑定
|
* 通过发送token以及devId给机器人实现绑定
|
||||||
* 格式支持`ai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`
|
* 格式支持`ai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`
|
||||||
* 新增指令`#云原神签到`可进行云原神签到
|
* 新增指令`#云原神签到`可进行云原神签到
|
||||||
@ -48,6 +51,4 @@
|
|||||||
*可以通过`#体力模板设置随机`来恢复之前的状态
|
*可以通过`#体力模板设置随机`来恢复之前的状态
|
||||||
* 增加`#**图鉴`用于查看逍遥全图鉴
|
* 增加`#**图鉴`用于查看逍遥全图鉴
|
||||||
* 增加`#图鉴更新`用于获取图鉴数据
|
* 增加`#图鉴更新`用于获取图鉴数据
|
||||||
* 增加`#图鉴插件(强制)更新`用于插件包更新
|
* 增加`#图鉴插件(强制)更新`用于插件包更新
|
||||||
# 1.0.0
|
|
||||||
* ~~~~~~~~~~~
|
|
@ -29,13 +29,13 @@ import {
|
|||||||
cookiesDocHelp,
|
cookiesDocHelp,
|
||||||
signlist,yunSignlist,yunAllSign,
|
signlist,yunSignlist,yunAllSign,
|
||||||
allMysSign,yunSign,sendyunTime,yuntoken,yunHelp,
|
allMysSign,yunSign,sendyunTime,yuntoken,yunHelp,
|
||||||
allSign
|
allSign,bbsSeach
|
||||||
} from "./sign.js"
|
} from "./sign.js"
|
||||||
export {
|
export {
|
||||||
updateRes,yunSignlist,
|
updateRes,yunSignlist,
|
||||||
signlist,
|
signlist,
|
||||||
updateMiaoPlugin,
|
updateMiaoPlugin,
|
||||||
sign,
|
sign,bbsSeach,
|
||||||
versionInfo,yunAllSign,
|
versionInfo,yunAllSign,
|
||||||
Note_appoint,
|
Note_appoint,
|
||||||
pokeNote,yunSign,sendyunTime,yuntoken,
|
pokeNote,yunSign,sendyunTime,yuntoken,
|
||||||
|
40
apps/sign.js
40
apps/sign.js
@ -11,12 +11,19 @@ import {
|
|||||||
} 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";
|
||||||
|
import {
|
||||||
|
segment
|
||||||
|
} from "oicq";
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
export const rule = {
|
export const rule = {
|
||||||
mysSign: {
|
mysSign: {
|
||||||
reg: "^#*(米游社|mys|社区)(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零|全部)签到$",
|
reg: "^#*(米游社|mys|社区)(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零|全部)签到$",
|
||||||
describe: "米游社米游币签到(理论上会签到全部所以区分开了)"
|
describe: "米游社米游币签到(理论上会签到全部所以区分开了)"
|
||||||
},
|
},
|
||||||
|
bbsSeach:{
|
||||||
|
reg: "^#*(米游币|米币)查询$",
|
||||||
|
describe: "米币查询"
|
||||||
|
},
|
||||||
sign: {
|
sign: {
|
||||||
reg: "^#*(崩坏3|崩坏2|未定事件簿)签到$",
|
reg: "^#*(崩坏3|崩坏2|未定事件簿)签到$",
|
||||||
describe: "米社规则签到"
|
describe: "米社规则签到"
|
||||||
@ -119,9 +126,14 @@ export async function mysSign(e) {
|
|||||||
e.reply("未读取到stoken请检查cookies是否包含login_ticket、以及云崽是否为最新版本V3、V2兼容")
|
e.reply("未读取到stoken请检查cookies是否包含login_ticket、以及云崽是否为最新版本V3、V2兼容")
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
START = moment().unix();
|
START = moment().unix();
|
||||||
let resultMessage = "";
|
let resultMessage = "";
|
||||||
|
let resObj=await mysSeach(e)
|
||||||
|
if(resObj.data.can_get_points===0){
|
||||||
|
resultMessage+=`今日米游币任务已完成~\n请勿重复操作\n当前米游币总持有数量为:${resObj.data.total_points}`;
|
||||||
|
await replyMsg(e, resultMessage);
|
||||||
|
return true
|
||||||
|
}
|
||||||
// Execute task
|
// Execute task
|
||||||
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
|
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
|
||||||
let ForumData = await getDataList(msg);
|
let ForumData = await getDataList(msg);
|
||||||
@ -203,11 +215,35 @@ export async function mysSign(e) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function bbsSeach(e){
|
||||||
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
|
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length == 0) {
|
||||||
|
e.reply("未读取到stoken请检查cookies是否包含login_ticket,请先绑定stoken再查询~");
|
||||||
|
await cookiesDocHelp(e);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
let resObj=await mysSeach(e)
|
||||||
|
e.reply(`当前米游币数量为:${resObj.data.total_points},今日剩余可获取:${resObj.data.can_get_points}`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
async function mysSeach(e){
|
||||||
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
|
try{
|
||||||
|
let resObj = await promiseRetry((retry, number) => {
|
||||||
|
return miHoYoApi.getTasksList().catch((e) => {
|
||||||
|
return retry(e);
|
||||||
|
});
|
||||||
|
}, RETRY_OPTIONS);
|
||||||
|
return resObj
|
||||||
|
}catch(e){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
async function replyMsg(e, resultMessage) {
|
async function replyMsg(e, resultMessage) {
|
||||||
const END = moment().unix();
|
const END = moment().unix();
|
||||||
Bot.logger.info(`运行结束, 用时 ${END - START} 秒`);
|
Bot.logger.info(`运行结束, 用时 ${END - START} 秒`);
|
||||||
resultMessage += `\n用时 ${END - START} 秒`;
|
resultMessage += `\n用时 ${END - START} 秒`;
|
||||||
e.reply(resultMessage);
|
e.reply([segment.at(e.user_id),"\n"+resultMessage]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDataList(name) {
|
async function getDataList(name) {
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
} from '../../components/Changelog.js';
|
} from '../../components/Changelog.js';
|
||||||
import fetch from "node-fetch"
|
import fetch from "node-fetch"
|
||||||
const APP_VERSION = "2.34.1";
|
const APP_VERSION = "2.34.1";
|
||||||
const salt="z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
|
const salt = "z8DRIUjNDT7IT5IZXvrUAxyupA1peND9";
|
||||||
//b253c83ab2609b1b600eddfe974df47b
|
//b253c83ab2609b1b600eddfe974df47b
|
||||||
const DEVICE_ID = utils.randomString(32).toUpperCase();
|
const DEVICE_ID = utils.randomString(32).toUpperCase();
|
||||||
const DEVICE_NAME = utils.randomString(_.random(1, 10));
|
const DEVICE_NAME = utils.randomString(_.random(1, 10));
|
||||||
@ -57,7 +57,7 @@ const boards = {
|
|||||||
forumid: 37,
|
forumid: 37,
|
||||||
biz: 'nxx_cn',
|
biz: 'nxx_cn',
|
||||||
name: '未定事件簿',
|
name: '未定事件簿',
|
||||||
actid:'e202202251749321',
|
actid: 'e202202251749321',
|
||||||
url: "https://bbs.mihoyo.com/wd/",
|
url: "https://bbs.mihoyo.com/wd/",
|
||||||
getReferer() {
|
getReferer() {
|
||||||
return `https://webstatic.mihoyo.com/bbs/event/signin/nxx/index.html?bbs_auth_required=true&bbs_presentation_style=fullscreen&act_id=${this.actid}`
|
return `https://webstatic.mihoyo.com/bbs/event/signin/nxx/index.html?bbs_auth_required=true&bbs_presentation_style=fullscreen&act_id=${this.actid}`
|
||||||
@ -87,8 +87,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.yuntoken = e.yuntoken
|
||||||
this.devId=e.devId
|
this.devId = e.devId
|
||||||
// //初始化配置文件
|
// //初始化配置文件
|
||||||
let data = this.getStoken(this.e.user_id);
|
let data = this.getStoken(this.e.user_id);
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -110,16 +110,16 @@ export default class MihoYoApi {
|
|||||||
try {
|
try {
|
||||||
// 获取账号信息
|
// 获取账号信息
|
||||||
const objData = await this.getUserInfo(kkbody)
|
const objData = await this.getUserInfo(kkbody)
|
||||||
let data=objData.data
|
let data = objData.data
|
||||||
if(data?.list?.length==0){
|
if (data?.list?.length == 0) {
|
||||||
return {
|
return {
|
||||||
message: `未绑定${name}信息`
|
message: `未绑定${name}信息`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let message=`\n${name}共计${data.list.length}个账号\n`;
|
let message = `\n${name}共计${data.list.length}个账号\n`;
|
||||||
for(let item of data.list){
|
for (let item of data.list) {
|
||||||
let objshuj=(await this.postSign(kkbody, item.game_uid, item.region))
|
let objshuj = (await this.postSign(kkbody, item.game_uid, item.region))
|
||||||
message+=`游戏id:${item.game_uid}:${objshuj.message=="OK"?"签到成功":objshuj.message}\n`
|
message += `游戏id:${item.game_uid}:${objshuj.message=="OK"?"签到成功":objshuj.message}\n`
|
||||||
await utils.randomSleepAsync();
|
await utils.randomSleepAsync();
|
||||||
}
|
}
|
||||||
// 获取签到信息和奖励信息 、、后续重新梳理补充
|
// 获取签到信息和奖励信息 、、后续重新梳理补充
|
||||||
@ -133,7 +133,9 @@ export default class MihoYoApi {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// 签到操作
|
// 签到操作
|
||||||
return {message}
|
return {
|
||||||
|
message
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Bot.logger.mark(`error.message`, error.message)
|
Bot.logger.mark(`error.message`, error.message)
|
||||||
}
|
}
|
||||||
@ -145,7 +147,12 @@ export default class MihoYoApi {
|
|||||||
// Bot.logger.mark(`ForumSign: ${res.text}`);
|
// Bot.logger.mark(`ForumSign: ${res.text}`);
|
||||||
return resObj;
|
return resObj;
|
||||||
}
|
}
|
||||||
|
async getTasksList() {
|
||||||
|
let res = await superagent.get(`https://bbs-api.mihoyo.com/apihub/sapi/getUserMissionsState`).set(this
|
||||||
|
._getHeader()).timeout(10000);
|
||||||
|
let resObj = JSON.parse(res.text);
|
||||||
|
return resObj
|
||||||
|
}
|
||||||
// 获取签到状态和奖励信息
|
// 获取签到状态和奖励信息
|
||||||
async getHonkai3rdSignInfo(game_uid, region, nickname, board) {
|
async getHonkai3rdSignInfo(game_uid, region, nickname, board) {
|
||||||
let res = await superagent.get(
|
let res = await superagent.get(
|
||||||
@ -221,7 +228,7 @@ export default class MihoYoApi {
|
|||||||
let 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);
|
||||||
let sendMSg = "";
|
let sendMSg = "";
|
||||||
let log_msg=(await this.logyunGenshen()).log_msg
|
let log_msg = (await this.logyunGenshen()).log_msg
|
||||||
sendMSg += log_msg
|
sendMSg += log_msg
|
||||||
Bot.logger.info(log_msg)
|
Bot.logger.info(log_msg)
|
||||||
url =
|
url =
|
||||||
@ -229,8 +236,8 @@ export default class MihoYoApi {
|
|||||||
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 resObj = JSON.parse(res.text);
|
||||||
let list = resObj.data.list;
|
let list = resObj.data.list;
|
||||||
if(Object.keys(list).length==0){
|
if (Object.keys(list).length == 0) {
|
||||||
resObj.sendMSg="您今天的奖励已经领取了啦~";
|
resObj.sendMSg = "您今天的奖励已经领取了啦~";
|
||||||
return resObj;
|
return resObj;
|
||||||
}
|
}
|
||||||
for (let item of list) {
|
for (let item of list) {
|
||||||
@ -238,27 +245,27 @@ export default class MihoYoApi {
|
|||||||
let reward_msg = item.msg;
|
let reward_msg = item.msg;
|
||||||
url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification?id=${reward_id}`;
|
url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification?id=${reward_id}`;
|
||||||
res = await superagent.post(url).set(this.getyunHeader()).timeout(10000);
|
res = await superagent.post(url).set(this.getyunHeader()).timeout(10000);
|
||||||
let log_msg=`\n领取奖励,ID:${reward_id},Msg:${reward_msg.msg}`;
|
let log_msg = `\n领取奖励,ID:${reward_id},Msg:${reward_msg.msg}`;
|
||||||
Bot.logger.info(log_msg)
|
Bot.logger.info(log_msg)
|
||||||
sendMSg+=log_msg
|
sendMSg += log_msg
|
||||||
}
|
}
|
||||||
// log_msg="\n\n"+(await this.logyunGenshen()).log_msg
|
// log_msg="\n\n"+(await this.logyunGenshen()).log_msg
|
||||||
// sendMSg += log_msg
|
// sendMSg += log_msg
|
||||||
resObj.sendMSg=sendMSg;
|
resObj.sendMSg = sendMSg;
|
||||||
// Bot.logger.info(log_msg)
|
// Bot.logger.info(log_msg)
|
||||||
return resObj;
|
return resObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
async logyunGenshen(){
|
async logyunGenshen() {
|
||||||
let url = `https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get`;
|
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 res = await superagent.get(url).set(this.getyunHeader()).timeout(10000);
|
||||||
let resObj = JSON.parse(res.text);
|
let resObj = JSON.parse(res.text);
|
||||||
let data = resObj.data
|
let data = resObj.data
|
||||||
let log_msg=`米云币:${data?.coin?.coin_num},免费时长:${data?.free_time?.free_time}分钟,总时长:${data.total_time}分钟`;
|
let log_msg = `米云币:${data?.coin?.coin_num},免费时长:${data?.free_time?.free_time}分钟,总时长:${data.total_time}分钟`;
|
||||||
resObj.log_msg=log_msg
|
resObj.log_msg = log_msg
|
||||||
return resObj
|
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user