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
80230474c1
commit
87a7fbbac2
@ -2,6 +2,9 @@
|
|||||||
* 新增指令`#米币查询`
|
* 新增指令`#米币查询`
|
||||||
* 新增`道具图鉴`图鉴数据
|
* 新增`道具图鉴`图鉴数据
|
||||||
* 修正米游币签到逻辑
|
* 修正米游币签到逻辑
|
||||||
|
* 补充指令`原神签到`
|
||||||
|
* 由于原神签到有提示验证码问题可能导致签到不了
|
||||||
|
* 补充指令 `原神签到`以及`米社原神全部签到`进行二次签到避免漏签
|
||||||
# 1.1.6
|
# 1.1.6
|
||||||
* 通过发送token以及devId给机器人实现绑定
|
* 通过发送token以及devId给机器人实现绑定
|
||||||
* 格式支持`ai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`
|
* 格式支持`ai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`
|
||||||
|
21
apps/sign.js
21
apps/sign.js
@ -25,11 +25,11 @@ export const rule = {
|
|||||||
describe: "米币查询"
|
describe: "米币查询"
|
||||||
},
|
},
|
||||||
sign: {
|
sign: {
|
||||||
reg: "^#*(崩坏3|崩坏2|未定事件簿)签到$",
|
reg: "^#*(原神|崩坏3|崩坏2|未定事件簿)签到$",
|
||||||
describe: "米社规则签到"
|
describe: "米社规则签到"
|
||||||
},
|
},
|
||||||
signlist: {
|
signlist: {
|
||||||
reg: "^#(米游币|米社)全部签到$",
|
reg: "^#(米游币|米社(原神|崩坏3|崩坏2|未定事件簿)*)全部签到$",
|
||||||
describe: "米游币全部签到"
|
describe: "米游币全部签到"
|
||||||
},
|
},
|
||||||
sendyunTime: {
|
sendyunTime: {
|
||||||
@ -90,7 +90,7 @@ export async function sign(e) {
|
|||||||
let ForumData = await getDataList(msg);
|
let ForumData = await getDataList(msg);
|
||||||
e.reply(`开始尝试${msg}签到预计${msg=='全部'?"60":"5-10"}秒~`)
|
e.reply(`开始尝试${msg}签到预计${msg=='全部'?"60":"5-10"}秒~`)
|
||||||
for (let forum of ForumData) {
|
for (let forum of ForumData) {
|
||||||
if (!(["崩坏3", "崩坏2", "未定事件簿"].includes(forum.name))) {
|
if (!(["原神","崩坏3", "崩坏2", "未定事件簿"].includes(forum.name))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
resultMessage += `**${forum.name}**\n`
|
resultMessage += `**${forum.name}**\n`
|
||||||
@ -226,6 +226,10 @@ export async function mysSign(e) {
|
|||||||
|
|
||||||
export async function bbsSeach(e){
|
export async function bbsSeach(e){
|
||||||
START = moment().unix();
|
START = moment().unix();
|
||||||
|
let isck = await cookie(e);
|
||||||
|
if (!isck) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
let miHoYoApi = new MihoYoApi(e);
|
let miHoYoApi = new MihoYoApi(e);
|
||||||
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length == 0) {
|
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length == 0) {
|
||||||
let cookiesDoc = await getcookiesDoc()
|
let cookiesDoc = await getcookiesDoc()
|
||||||
@ -377,7 +381,7 @@ export async function allMysSign() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//定时签到任务
|
//定时签到任务
|
||||||
export async function allSign() {
|
export async function allSign(e="") {
|
||||||
Bot.logger.mark(`开始米社签到任务`);
|
Bot.logger.mark(`开始米社签到任务`);
|
||||||
let isAllSign = await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").isAllSign
|
let isAllSign = await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").isAllSign
|
||||||
let userIdList = [];
|
let userIdList = [];
|
||||||
@ -390,6 +394,7 @@ export async function allSign() {
|
|||||||
userIdList.push(user_id)
|
userIdList.push(user_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let msg=e?.msg;
|
||||||
for (let qq of userIdList) {
|
for (let qq of userIdList) {
|
||||||
let user_id = qq;
|
let user_id = qq;
|
||||||
let e = {
|
let e = {
|
||||||
@ -397,7 +402,11 @@ export async function allSign() {
|
|||||||
qq,
|
qq,
|
||||||
isTask: true
|
isTask: true
|
||||||
};
|
};
|
||||||
e.msg = "全部"
|
if(msg){
|
||||||
|
e.msg=msg.replace(/全部|签到|米社/g,"");
|
||||||
|
}else{
|
||||||
|
e.msg = "全部"
|
||||||
|
}
|
||||||
Bot.logger.mark(`正在为qq${user_id}米社签到中...`);
|
Bot.logger.mark(`正在为qq${user_id}米社签到中...`);
|
||||||
e.reply = (msg) => {
|
e.reply = (msg) => {
|
||||||
if (!isAllSign||isbool) {
|
if (!isAllSign||isbool) {
|
||||||
@ -445,7 +454,7 @@ export async function signlist(e) {
|
|||||||
await allMysSign()
|
await allMysSign()
|
||||||
} else {
|
} else {
|
||||||
isbool = true;
|
isbool = true;
|
||||||
await allSign()
|
await allSign(e)
|
||||||
}
|
}
|
||||||
e.reply(`${msg}签到任务已完成`);
|
e.reply(`${msg}签到任务已完成`);
|
||||||
ismysbool=false;
|
ismysbool=false;
|
||||||
|
@ -118,8 +118,13 @@ export default class MihoYoApi {
|
|||||||
}
|
}
|
||||||
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.isPostSign(kkbody, item.game_uid, item.region)
|
||||||
message += `游戏id:${item.game_uid}:${objshuj.message=="OK"?"签到成功":objshuj.message}\n`
|
if(objshuj.retcode==0){
|
||||||
|
message+=`游戏id:${item.nickname}-${item.game_uid}:今日已签到~\n`;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
objshuj=(await this.postSign(kkbody, item.game_uid, item.region))
|
||||||
|
message += `游戏id:${item.nickname}-${item.game_uid}:${objshuj.message=="OK"?"签到成功":objshuj.message}\n`
|
||||||
await utils.randomSleepAsync();
|
await utils.randomSleepAsync();
|
||||||
}
|
}
|
||||||
// 获取签到信息和奖励信息 、、后续重新梳理补充
|
// 获取签到信息和奖励信息 、、后续重新梳理补充
|
||||||
@ -323,15 +328,15 @@ export default class MihoYoApi {
|
|||||||
getpubHeaders(board) {
|
getpubHeaders(board) {
|
||||||
const randomStr = utils.randomString(6);
|
const randomStr = utils.randomString(6);
|
||||||
const timestamp = Math.floor(Date.now() / 1000)
|
const timestamp = Math.floor(Date.now() / 1000)
|
||||||
let sign = md5(`salt=b253c83ab2609b1b600eddfe974df47b&t=${timestamp}&r=${randomStr}`);
|
let sign = md5(`salt=9nQiU3AV0rJSIBWgdynfoGMGKaklfbM7&t=${timestamp}&r=${randomStr}`);
|
||||||
return {
|
return {
|
||||||
'accept-language': 'zh-CN,zh;q=0.9,ja-JP;q=0.8,ja;q=0.7,en-US;q=0.6,en;q=0.5',
|
'accept-language': 'zh-CN,zh;q=0.9,ja-JP;q=0.8,ja;q=0.7,en-US;q=0.6,en;q=0.5',
|
||||||
'x-rpc-device_id': DEVICE_ID,
|
'x-rpc-device_id': DEVICE_ID,
|
||||||
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/2.3.0',
|
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) miHoYoBBS/2.34.1',
|
||||||
Referer: board.getReferer(),
|
Referer: board.getReferer(),
|
||||||
Host: 'api-takumi.mihoyo.com',
|
Host: 'api-takumi.mihoyo.com',
|
||||||
'x-rpc-channel': 'appstore',
|
'x-rpc-channel': 'appstore',
|
||||||
'x-rpc-app_version': '2.3.0',
|
'x-rpc-app_version': '2.34.1',
|
||||||
'x-requested-with': 'com.mihoyo.hyperion',
|
'x-requested-with': 'com.mihoyo.hyperion',
|
||||||
'x-rpc-client_type': '5',
|
'x-rpc-client_type': '5',
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
@ -421,6 +426,22 @@ export default class MihoYoApi {
|
|||||||
// const nickname = data?.list?. [0]?.nickname
|
// const nickname = data?.list?. [0]?.nickname
|
||||||
return resObj
|
return resObj
|
||||||
}
|
}
|
||||||
|
// 游戏签到操作查询
|
||||||
|
async isPostSign(board, game_uid, region) {
|
||||||
|
let web_api = `https://api-takumi.mihoyo.com`
|
||||||
|
let url =
|
||||||
|
`${web_api}/event/luna/info?lang=zh-cn`
|
||||||
|
if (board.name == "原神") {
|
||||||
|
url = `${web_api}/event/bbs_sign_reward/info`
|
||||||
|
}
|
||||||
|
if (board.name == "崩坏2" || board.name == "未定事件簿") {
|
||||||
|
url = `${web_api}/event/luna/info?lang=zh-cn`
|
||||||
|
}
|
||||||
|
url += `${board.name == "原神"?"?":"&"}region=${region}&act_id=${board.actid}&uid=${game_uid}`
|
||||||
|
let res = await superagent.get(url).set(this.getpubHeaders(board)).timeout(10000);
|
||||||
|
let resObj = JSON.parse(res.text);
|
||||||
|
return resObj
|
||||||
|
}
|
||||||
// 游戏签到操作
|
// 游戏签到操作
|
||||||
async postSign(board, game_uid, region) {
|
async postSign(board, game_uid, region) {
|
||||||
let web_api = `https://api-takumi.mihoyo.com`
|
let web_api = `https://api-takumi.mihoyo.com`
|
||||||
|
Loading…
Reference in New Issue
Block a user