2022-08-02 20:20:34 +08:00
|
|
|
|
import MihoYoApi from "../model/mys/mihoyo-api.js"
|
2022-07-29 01:42:35 +08:00
|
|
|
|
import utils from '../model/mys/utils.js';
|
|
|
|
|
import promiseRetry from 'promise-retry';
|
|
|
|
|
import {
|
|
|
|
|
Cfg,
|
|
|
|
|
Data
|
|
|
|
|
} from "../components/index.js";
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
import MysInfo from '../model/mys/mysInfo.js'
|
|
|
|
|
import {
|
|
|
|
|
isV3
|
|
|
|
|
} from '../components/Changelog.js';
|
2022-07-29 22:43:28 +08:00
|
|
|
|
import gsCfg from '../model/gsCfg.js';
|
2022-08-01 23:13:34 +08:00
|
|
|
|
import fs from "fs";
|
2022-07-29 01:42:35 +08:00
|
|
|
|
export const rule = {
|
|
|
|
|
mysSign: {
|
|
|
|
|
reg: "^#*(米游社|mys|社区)(原神|崩坏3|崩坏2|未定事件簿|大别野|崩坏星穹铁道|绝区零|全部)签到$",
|
|
|
|
|
describe: "米游社米游币签到(理论上会签到全部所以区分开了)"
|
|
|
|
|
},
|
|
|
|
|
sign: {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
reg: "^#*(崩坏3|崩坏2|未定事件簿)签到$",
|
2022-07-29 01:42:35 +08:00
|
|
|
|
describe: "米社规则签到"
|
2022-07-29 22:43:28 +08:00
|
|
|
|
},
|
2022-08-02 20:20:34 +08:00
|
|
|
|
signlist: {
|
2022-08-02 13:59:26 +08:00
|
|
|
|
reg: "^#(米游币|米社)全部签到$",
|
2022-08-02 20:20:34 +08:00
|
|
|
|
describe: "米游币全部签到"
|
2022-08-01 23:13:34 +08:00
|
|
|
|
},
|
2022-08-02 13:59:26 +08:00
|
|
|
|
// allMysSign: {
|
|
|
|
|
// reg: "^#米游币全部签到$",
|
|
|
|
|
// describe: "米游币全部签到"
|
|
|
|
|
// },
|
|
|
|
|
// allSign: {
|
|
|
|
|
// reg: "^#米社全部签到$",
|
|
|
|
|
// describe: "米社全部签到"
|
|
|
|
|
// },
|
2022-07-29 22:43:28 +08:00
|
|
|
|
cookiesDocHelp: {
|
|
|
|
|
reg: "^#*(米游社|cookies|米游币)帮助$",
|
|
|
|
|
describe: "cookies获取帮助"
|
2022-07-29 01:42:35 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const _path = process.cwd();
|
|
|
|
|
let START = moment().unix();
|
|
|
|
|
const TODAY_DATE = moment().format('YYYY-MM-DD');
|
|
|
|
|
const RETRY_OPTIONS = {
|
|
|
|
|
retries: 3,
|
|
|
|
|
minTimeout: 5000,
|
|
|
|
|
maxTimeout: 10000
|
|
|
|
|
};
|
2022-08-02 21:29:48 +08:00
|
|
|
|
let YamlDataUrl = `${_path}/plugins/xiaoyao-cvs-plugin/data/yaml`;
|
2022-07-29 01:42:35 +08:00
|
|
|
|
export async function sign(e) {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let {
|
2022-08-02 20:20:34 +08:00
|
|
|
|
skuid,
|
|
|
|
|
cookie
|
2022-08-01 23:13:34 +08:00
|
|
|
|
} = await getCookie(e);
|
2022-08-01 23:23:58 +08:00
|
|
|
|
if (!cookie) {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
e.reply("请先绑定cookie~\n发送【cookie帮助】获取教程")
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-08-01 23:13:34 +08:00
|
|
|
|
|
2022-07-29 01:42:35 +08:00
|
|
|
|
START = moment().unix();
|
|
|
|
|
let miHoYoApi = new MihoYoApi(e);
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let resultMessage = "";
|
2022-07-29 01:42:35 +08:00
|
|
|
|
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
|
|
|
|
|
let ForumData = await getDataList(msg);
|
2022-07-31 12:32:03 +08:00
|
|
|
|
e.reply(`开始尝试${msg}签到预计${msg=='全部'?"60":"5-10"}秒~`)
|
2022-07-29 01:42:35 +08:00
|
|
|
|
for (let forum of ForumData) {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
if (!(["崩坏3", "崩坏2", "未定事件簿"].includes(forum.name))) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2022-07-29 01:42:35 +08:00
|
|
|
|
resultMessage += `**${forum.name}**\n`
|
|
|
|
|
try {
|
|
|
|
|
// 1 BBS Sign
|
|
|
|
|
let resObj = await promiseRetry((retry, number) => {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
// Bot.logger.info(`开始签到: [${forum.name}] 尝试次数: ${number}`);
|
|
|
|
|
return miHoYoApi.honkai3rdSignTask(forum.name).catch((e) => {
|
2022-07-29 01:42:35 +08:00
|
|
|
|
Bot.logger.error(`${forum.name} 签到失败: [${e.message}] 尝试次数: ${number}`);
|
|
|
|
|
return retry(e);
|
|
|
|
|
});
|
|
|
|
|
}, RETRY_OPTIONS);
|
|
|
|
|
Bot.logger.info(`${forum.name} 签到结果: [${resObj.message}]`);
|
|
|
|
|
resultMessage += `签到: [${resObj.message}]\n`;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
Bot.logger.error(`${forum.name} 签到失败 [${e.message}]`);
|
|
|
|
|
resultMessage += `签到失败: [${e.message}]\n`;
|
|
|
|
|
}
|
2022-08-01 23:13:34 +08:00
|
|
|
|
|
2022-07-29 01:42:35 +08:00
|
|
|
|
await utils.randomSleepAsync();
|
|
|
|
|
}
|
2022-08-01 23:13:34 +08:00
|
|
|
|
await replyMsg(e, resultMessage);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
export async function mysSign(e) {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let isck = await cookie(e);
|
2022-07-29 09:59:48 +08:00
|
|
|
|
if (!isck) {
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let iscount = "";
|
2022-07-29 01:42:35 +08:00
|
|
|
|
let miHoYoApi = new MihoYoApi(e);
|
2022-08-01 23:13:34 +08:00
|
|
|
|
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length == 0) {
|
2022-08-02 20:20:34 +08:00
|
|
|
|
e.reply("未读取到stoken请检查cookies是否包含login_ticket、以及云崽是否为最新版本V3、V2兼容")
|
2022-07-29 09:59:48 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-08-01 23:13:34 +08:00
|
|
|
|
|
2022-07-29 09:59:48 +08:00
|
|
|
|
START = moment().unix();
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let resultMessage = "";
|
2022-07-29 01:42:35 +08:00
|
|
|
|
// Execute task
|
|
|
|
|
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
|
|
|
|
|
let ForumData = await getDataList(msg);
|
2022-07-30 10:01:19 +08:00
|
|
|
|
e.reply(`开始尝试${msg}社区签到预计${msg=='全部'?"10-20":"1-3"}分钟~`)
|
2022-07-31 12:32:03 +08:00
|
|
|
|
for (let forum of ForumData) {
|
|
|
|
|
resultMessage += `**${forum.name}**\n`
|
|
|
|
|
try {
|
|
|
|
|
// 1 BBS Sign
|
|
|
|
|
let resObj = await promiseRetry((retry, number) => {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
// Bot.logger.info(`开始签到: [${forum.name}] 尝试次数: ${number}`);
|
2022-07-31 12:32:03 +08:00
|
|
|
|
return miHoYoApi.forumSign(forum.forumId).catch((e) => {
|
|
|
|
|
Bot.logger.error(`${forum.name} 签到失败: [${e.message}] 尝试次数: ${number}`);
|
|
|
|
|
return retry(e);
|
|
|
|
|
});
|
|
|
|
|
}, RETRY_OPTIONS);
|
|
|
|
|
Bot.logger.info(`${forum.name} 签到结果: [${resObj.message}]`);
|
|
|
|
|
resultMessage += `签到: [${resObj.message}]\n`;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
Bot.logger.error(`${forum.name} 签到失败 [${e.message}]`);
|
|
|
|
|
resultMessage += `签到失败: [${e.message}]\n`;
|
|
|
|
|
}
|
|
|
|
|
await utils.randomSleepAsync();
|
|
|
|
|
}
|
2022-07-29 01:42:35 +08:00
|
|
|
|
for (let forum of ForumData) {
|
|
|
|
|
resultMessage += `\n**${forum.name}**\n`
|
|
|
|
|
try {
|
|
|
|
|
// 2 BBS list post
|
|
|
|
|
let resObj = await promiseRetry((retry, number) => {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
// Bot.logger.info(`读取帖子列表: [${forum.name}] 尝试次数: ${number}`);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return miHoYoApi.forumPostList(forum.forumId).catch((e) => {
|
|
|
|
|
Bot.logger.error(`${forum.name} 读取帖子列表失败: [${e.message}] 尝试次数: ${number}`);
|
|
|
|
|
return retry(e);
|
|
|
|
|
});
|
|
|
|
|
}, RETRY_OPTIONS);
|
|
|
|
|
Bot.logger.info(`${forum.name} 读取列表成功 [${resObj.message}],读取到 [${resObj.data.list.length}] 条记录`);
|
|
|
|
|
|
|
|
|
|
let postList = resObj.data.list;
|
|
|
|
|
for (let post of postList) {
|
|
|
|
|
post = post.post;
|
|
|
|
|
// 2.1 BBS read post
|
|
|
|
|
let resObj = await promiseRetry((retry, number) => {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
// Bot.logger.info(`读取帖子: [${post.subject}] 尝试次数: ${number}`);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return miHoYoApi.forumPostDetail(post['post_id']).catch((e) => {
|
|
|
|
|
Bot.logger.error(`${forum.name} 读取帖子失败: [${e.message}] 尝试次数: ${number}`);
|
|
|
|
|
return retry(e);
|
|
|
|
|
});
|
|
|
|
|
}, RETRY_OPTIONS);
|
2022-08-01 23:13:34 +08:00
|
|
|
|
// Bot.logger.info(`${forum.name} [${post.subject}] 读取成功 [${resObj.message}]`);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
await utils.randomSleepAsync();
|
|
|
|
|
// 2.2 BBS vote post
|
|
|
|
|
resObj = await promiseRetry((retry, number) => {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
// Bot.logger.info(`点赞帖子: [${post.subject}] 尝试次数: ${number}`);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return miHoYoApi.forumPostVote(post['post_id']).catch((e) => {
|
|
|
|
|
Bot.logger.error(`${forum.name} 点赞帖子失败: [${e.message}] 尝试次数: ${number}`);
|
|
|
|
|
return retry(e);
|
|
|
|
|
});
|
|
|
|
|
}, RETRY_OPTIONS);
|
|
|
|
|
|
2022-08-01 23:13:34 +08:00
|
|
|
|
// Bot.logger.info(`${forum.name} [${post.subject}] 点赞成功 [${resObj.message}]`);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
await utils.randomSleepAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 2.3 BBS share post
|
|
|
|
|
let sharePost = postList[0].post;
|
|
|
|
|
resObj = await promiseRetry((retry, number) => {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
// Bot.logger.info(`分享帖子: [${sharePost.subject}] 尝试次数: ${number}`);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return miHoYoApi.forumPostShare(sharePost['post_id']).catch((e) => {
|
|
|
|
|
Bot.logger.error(`${forum.name} 分享帖子失败: [${e.message}] 尝试次数: ${number}`);
|
|
|
|
|
return retry(e);
|
|
|
|
|
});
|
|
|
|
|
}, RETRY_OPTIONS);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
Bot.logger.error(`${forum.name} 读帖点赞分享失败 [${e.message}]`);
|
|
|
|
|
resultMessage += `读帖点赞分享: 失败 [${e.message}]\n`;
|
|
|
|
|
}
|
|
|
|
|
resultMessage += `读帖点赞分享: 成功\n`;
|
|
|
|
|
await utils.randomSleepAsync();
|
|
|
|
|
}
|
2022-08-01 23:13:34 +08:00
|
|
|
|
await replyMsg(e, resultMessage);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-01 23:13:34 +08:00
|
|
|
|
async function replyMsg(e, resultMessage) {
|
2022-07-29 01:42:35 +08:00
|
|
|
|
const END = moment().unix();
|
|
|
|
|
Bot.logger.info(`运行结束, 用时 ${END - START} 秒`);
|
|
|
|
|
resultMessage += `\n用时 ${END - START} 秒`;
|
|
|
|
|
e.reply(resultMessage);
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-01 23:13:34 +08:00
|
|
|
|
async function getDataList(name) {
|
2022-07-29 01:42:35 +08:00
|
|
|
|
let ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys")
|
2022-08-01 23:13:34 +08:00
|
|
|
|
for (let item of ForumData) {
|
|
|
|
|
if (item.name == name) { //循环结束未找到的时候返回原数组签到全部
|
2022-07-29 01:42:35 +08:00
|
|
|
|
return [item]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ForumData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function cookie(e) {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let {
|
|
|
|
|
cookie,
|
2022-08-04 10:04:20 +08:00
|
|
|
|
uid,skuid
|
2022-08-01 23:13:34 +08:00
|
|
|
|
} = await getCookie(e);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
let miHoYoApi = new MihoYoApi(e);
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let cookiesDoc = await getcookiesDoc();
|
|
|
|
|
|
|
|
|
|
if (!cookie) {
|
|
|
|
|
e.reply("cookie失效请重新绑定~【教程】\n" + cookiesDoc)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Object.keys((await miHoYoApi.getStoken(e.user_id))).length != 0) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (!cookie.includes("login_ticket") && (isV3 && !skuid?.login_ticket)) {
|
|
|
|
|
e.reply("米游社登录cookie不完整,请前往米游社通行证处重新获取cookie~\ncookies必须包含login_ticket【教程】 " + cookiesDoc)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
let flot = (await miHoYoApi.stoken(cookie, e));
|
|
|
|
|
// console.log(flot)
|
|
|
|
|
await utils.sleepAsync(1000); //延迟加载防止文件未生成
|
|
|
|
|
if (!flot) {
|
|
|
|
|
e.reply("登录失效请重新登录获取cookie发送机器人~")
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
async function getCookie(e) {
|
|
|
|
|
let skuid, cookie, uid
|
2022-07-29 01:42:35 +08:00
|
|
|
|
if (isV3) {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
skuid = await gsCfg.getBingCookie(e.user_id);
|
2022-07-29 01:42:35 +08:00
|
|
|
|
cookie = skuid.ck;
|
|
|
|
|
uid = skuid.item;
|
|
|
|
|
} else {
|
|
|
|
|
if (NoteCookie[e.user_id]) {
|
|
|
|
|
cookie = NoteCookie[e.user_id].cookie;
|
|
|
|
|
uid = NoteCookie[e.user_id].uid;
|
2022-08-01 23:13:34 +08:00
|
|
|
|
skuid = NoteCookie[e.user_id];
|
2022-07-29 01:42:35 +08:00
|
|
|
|
} else if (BotConfig.dailyNote && BotConfig.dailyNote[e.user_id]) {
|
|
|
|
|
cookie = BotConfig.dailyNote[e.user_id].cookie;
|
|
|
|
|
uid = BotConfig.dailyNote[e.user_id].uid;
|
2022-08-01 23:13:34 +08:00
|
|
|
|
skuid = BotConfig.NoteCookie[e.user_id];
|
2022-07-29 01:42:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
e.uid = uid;
|
2022-08-01 23:13:34 +08:00
|
|
|
|
e.cookie = cookie;
|
|
|
|
|
return {
|
|
|
|
|
cookie,
|
|
|
|
|
uid,
|
|
|
|
|
skuid
|
2022-07-29 01:42:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-01 23:13:34 +08:00
|
|
|
|
export async function cookiesDocHelp(e) {
|
|
|
|
|
let cookiesDoc = await getcookiesDoc()
|
|
|
|
|
e.reply("【cookies帮助】" + cookiesDoc + "\ncookies必须包含login_ticket获取后请私发机器人");
|
2022-07-29 22:43:28 +08:00
|
|
|
|
return true
|
|
|
|
|
}
|
2022-08-01 23:13:34 +08:00
|
|
|
|
async function getcookiesDoc() {
|
|
|
|
|
return await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").cookiesDoc
|
|
|
|
|
}
|
|
|
|
|
//定时米社米币签到任务
|
|
|
|
|
export async function allMysSign() {
|
2022-08-02 13:59:26 +08:00
|
|
|
|
Bot.logger.mark(`开始米社米币签到任务`);
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let stoken = await gsCfg.getBingStoken();
|
|
|
|
|
let isPushSign = await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").isPushSign
|
|
|
|
|
//获取需要签到的用户
|
|
|
|
|
for (let data of stoken) {
|
|
|
|
|
let user_id = data.qq;
|
|
|
|
|
Bot.logger.mark(`正在为qq${user_id}签到`);
|
|
|
|
|
let e = {
|
|
|
|
|
user_id,
|
|
|
|
|
isTask: true
|
|
|
|
|
};
|
|
|
|
|
e.cookie = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
|
|
|
|
e.msg = "全部"
|
|
|
|
|
//已签到不重复执行
|
|
|
|
|
let key = `genshin:mys:signed_bbs:${user_id}`;
|
|
|
|
|
if (await redis.get(key)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e.reply = (msg) => {
|
|
|
|
|
//关闭签到消息推送
|
2022-08-03 21:25:29 +08:00
|
|
|
|
if (!isPushSign||ismysbool) {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (msg.includes("签到成功") && (cookie.isSignPush === true || cookie.isSignPush === undefined)) {
|
|
|
|
|
// msg = msg.replace("签到成功", "自动签到成功");
|
|
|
|
|
utils.relpyPrivate(user_id, msg + "\n自动签到成功");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
await mysSign(e);
|
|
|
|
|
await utils.sleepAsync(10000);
|
|
|
|
|
}
|
|
|
|
|
Bot.logger.mark(`签到任务完成`);
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//定时签到任务
|
|
|
|
|
export async function allSign() {
|
|
|
|
|
Bot.logger.mark(`开始米社签到任务`);
|
2022-08-02 13:59:26 +08:00
|
|
|
|
let isAllSign = await gsCfg.getfileYaml(`${_path}/plugins/xiaoyao-cvs-plugin/config/`, "config").isAllSign
|
2022-08-01 23:13:34 +08:00
|
|
|
|
let userIdList = [];
|
|
|
|
|
if (isV3) {
|
|
|
|
|
let dir = './data/MysCookie/'
|
|
|
|
|
let files = fs.readdirSync(dir).filter(file => file.endsWith('.yaml'))
|
|
|
|
|
userIdList = (files.join(",").replace(/.yaml/g, "").split(","))
|
|
|
|
|
} else {
|
|
|
|
|
for (let [user_id, cookie] of Object.entries(NoteCookie)) {
|
|
|
|
|
userIdList.push(user_id)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (let qq of userIdList) {
|
|
|
|
|
let user_id = qq;
|
|
|
|
|
let e = {
|
|
|
|
|
user_id,
|
|
|
|
|
qq,
|
|
|
|
|
isTask: true
|
|
|
|
|
};
|
2022-08-02 20:20:34 +08:00
|
|
|
|
e.msg = "全部"
|
2022-08-01 23:13:34 +08:00
|
|
|
|
e.reply = (msg) => {
|
|
|
|
|
if (!msg.includes("OK")) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-08-03 21:25:29 +08:00
|
|
|
|
if (!isAllSign||isbool) {
|
2022-08-01 23:13:34 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (msg.includes("签到成功") && (cookie.isSignPush === true || cookie.isSignPush === undefined)) {
|
|
|
|
|
utils.relpyPrivate(qq, msg + "\n自动签到成功");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
await sign(e);
|
|
|
|
|
await utils.sleepAsync(10000);
|
|
|
|
|
}
|
|
|
|
|
Bot.logger.mark(`签到任务完成`);
|
2022-07-29 22:43:28 +08:00
|
|
|
|
}
|
2022-08-02 13:59:26 +08:00
|
|
|
|
const checkAuth = async function(e) {
|
|
|
|
|
return await e.checkAuth({
|
|
|
|
|
auth: "master",
|
|
|
|
|
replyMsg: `只有主人才能命令我哦~
|
|
|
|
|
(*/ω\*)`
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-08-02 20:20:34 +08:00
|
|
|
|
let isbool = false;
|
|
|
|
|
let ismysbool = false;
|
|
|
|
|
export async function signlist(e) {
|
2022-08-02 13:59:26 +08:00
|
|
|
|
if (!await checkAuth(e)) {
|
2022-08-02 20:20:34 +08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (isbool) {
|
|
|
|
|
e.reply(`米社签到中请勿重复执行`)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if (ismysbool) {
|
|
|
|
|
e.reply(`米游币签到中请勿重复执行`)
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
let msg = e.msg.replace(/#|全部签到/g, "")
|
2022-08-02 13:59:26 +08:00
|
|
|
|
e.reply(`开始执行${msg}签到中,请勿重复执行`);
|
2022-08-02 20:20:34 +08:00
|
|
|
|
if (msg == "米游币") {
|
2022-08-02 21:29:48 +08:00
|
|
|
|
if(!fs.existsSync(YamlDataUrl)){
|
|
|
|
|
Data.createDir("", YamlDataUrl, false);
|
|
|
|
|
e.reply("未读取到可签到文件")
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-08-02 20:20:34 +08:00
|
|
|
|
ismysbool=true;
|
2022-08-02 13:59:26 +08:00
|
|
|
|
await allMysSign()
|
2022-08-02 20:20:34 +08:00
|
|
|
|
} else {
|
|
|
|
|
isbool = true;
|
2022-08-02 13:59:26 +08:00
|
|
|
|
await allSign()
|
|
|
|
|
}
|
|
|
|
|
e.reply(`${msg}签到任务已完成`);
|
2022-08-02 20:20:34 +08:00
|
|
|
|
ismysbool=false;
|
|
|
|
|
isbool = false;
|
|
|
|
|
return true;
|
2022-08-02 13:59:26 +08:00
|
|
|
|
}
|