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
609d2ceb7e
commit
bc7ad7b40e
42
apps/Note.js
42
apps/Note.js
@ -28,29 +28,29 @@ function init() {
|
|||||||
export async function Note(e, {
|
export async function Note(e, {
|
||||||
render
|
render
|
||||||
}, poke) {
|
}, poke) {
|
||||||
if (!Cfg.get("sys.Note") && !poke) {
|
if (!Cfg.get("sys.Note") && !poke && !this.e?.isTask) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let notes = new note(e);
|
let notes = new note(e);
|
||||||
let cookie, uid, res;
|
let cookie, uid, res;
|
||||||
if (isV3) {
|
if (isV3) {
|
||||||
if(e.msg.replace(/全|全部/g,'多').includes('多')){
|
if (e.msg.replace(/全|全部/g, '多').includes('多')) {
|
||||||
let ck=await gsCfg.getBingCkSingle(e.user_id)
|
let ck = await gsCfg.getBingCkSingle(e.user_id)
|
||||||
if(Object.keys(ck).length==0){
|
if (Object.keys(ck).length == 0) {
|
||||||
e.reply(`请先【#绑定cookie】`)
|
e.reply(`请先【#绑定cookie】`)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let sendMsg=[]
|
let sendMsg = []
|
||||||
e._reply=e.reply;
|
e._reply = e.reply;
|
||||||
e.reply=((msg)=>{
|
e.reply = ((msg) => {
|
||||||
sendMsg.push(msg)
|
sendMsg.push(msg)
|
||||||
})
|
})
|
||||||
if(Object.keys(ck).length>1){
|
if (Object.keys(ck).length > 1) {
|
||||||
e._reply(`多账号体力查询中请稍等...`)
|
e._reply(`多账号体力查询中请稍等...`)
|
||||||
}
|
}
|
||||||
for(let item of Object.keys(ck)){
|
for (let item of Object.keys(ck)) {
|
||||||
let res=await (await e.runtime.createMysApi(ck[item].uid,ck[item].ck)).getData('dailyNote')
|
let res = await (await e.runtime.createMysApi(ck[item].uid, ck[item].ck)).getData('dailyNote')
|
||||||
await notes.getNote(ck[item].ck,ck[item].uid,res,{render})
|
await notes.getNote(ck[item].ck, ck[item].uid, res, { render })
|
||||||
}
|
}
|
||||||
e._reply(sendMsg)
|
e._reply(sendMsg)
|
||||||
return true;
|
return true;
|
||||||
@ -114,7 +114,7 @@ export async function Note(e, {
|
|||||||
saveJson();
|
saveJson();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await notes.getNote(cookie,uid,res,{render})
|
return await notes.getNote(cookie, uid, res, { render })
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDailyNote(uid, cookie) {
|
async function getDailyNote(uid, cookie) {
|
||||||
@ -226,7 +226,7 @@ export async function pokeNote(e, {
|
|||||||
|
|
||||||
export async function Note_appoint(e) {
|
export async function Note_appoint(e) {
|
||||||
let mbPath = `${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/`;
|
let mbPath = `${_path}/plugins/xiaoyao-cvs-plugin/resources/dailyNote/`;
|
||||||
let isDel= e.msg.includes("移除")
|
let isDel = e.msg.includes("移除")
|
||||||
let msg = e.msg.replace(/#|井|体力|模板|设置|移除/g, "");
|
let msg = e.msg.replace(/#|井|体力|模板|设置|移除/g, "");
|
||||||
let All = ["默认", "随机", "0"];
|
let All = ["默认", "随机", "0"];
|
||||||
let urlType = note_file();
|
let urlType = note_file();
|
||||||
@ -242,7 +242,7 @@ export async function Note_appoint(e) {
|
|||||||
if (msg.includes("列表")) {
|
if (msg.includes("列表")) {
|
||||||
let isUser = msg.includes('我的')
|
let isUser = msg.includes('我的')
|
||||||
let temp = tempData[e.user_id]?.temp;
|
let temp = tempData[e.user_id]?.temp;
|
||||||
if ((!temp||temp?.length===0) && isUser) {
|
if ((!temp || temp?.length === 0) && isUser) {
|
||||||
e.reply("未获取到您设置的模板信息哦~")
|
e.reply("未获取到您设置的模板信息哦~")
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -316,16 +316,16 @@ export async function Note_appoint(e) {
|
|||||||
if (typeof tempData[e.user_id]["temp"] === "string") {
|
if (typeof tempData[e.user_id]["temp"] === "string") {
|
||||||
temp = [tempData[e.user_id]["temp"], msg]
|
temp = [tempData[e.user_id]["temp"], msg]
|
||||||
} else {
|
} else {
|
||||||
temp =tempData[e.user_id]["temp"]
|
temp = tempData[e.user_id]["temp"]
|
||||||
if (!tempData[e.user_id]["temp"]?.includes(msg)) {
|
if (!tempData[e.user_id]["temp"]?.includes(msg)) {
|
||||||
temp.push(msg)
|
temp.push(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let sendMsg="诶~这是你选的模板吗,模板设置成功了快用指令来试试吧~!"
|
let sendMsg = "诶~这是你选的模板吗,模板设置成功了快用指令来试试吧~!"
|
||||||
if(isDel){
|
if (isDel) {
|
||||||
if(temp.includes(msg)){
|
if (temp.includes(msg)) {
|
||||||
temp.splice(temp.indexOf(msg),1)
|
temp.splice(temp.indexOf(msg), 1)
|
||||||
sendMsg=`模板${msg}已移除~`
|
sendMsg = `模板${msg}已移除~`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tempData[e.user_id] = {
|
tempData[e.user_id] = {
|
||||||
@ -338,7 +338,7 @@ export async function Note_appoint(e) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const note_file = function(xiaoyao) {
|
const note_file = function (xiaoyao) {
|
||||||
let url1 = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/Template/`
|
let url1 = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/Template/`
|
||||||
let url2 = `./plugins/xiaoyao-cvs-plugin/resources/BJT-Templet/` //冤种情况。。
|
let url2 = `./plugins/xiaoyao-cvs-plugin/resources/BJT-Templet/` //冤种情况。。
|
||||||
let url3 = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image/`
|
let url3 = `./plugins/xiaoyao-cvs-plugin/resources/dailyNote/background_image/`
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
} from '../components/Changelog.js'
|
} from '../components/Changelog.js'
|
||||||
import utils from './mys/utils.js';
|
import utils from './mys/utils.js';
|
||||||
import gsCfg from './gsCfg.js';
|
import gsCfg from './gsCfg.js';
|
||||||
import {segment} from 'oicq'
|
import { segment } from 'oicq'
|
||||||
export default class mysTopLogin {
|
export default class mysTopLogin {
|
||||||
constructor(e) {
|
constructor(e) {
|
||||||
this.e = e;
|
this.e = e;
|
||||||
@ -64,7 +64,7 @@ export default class mysTopLogin {
|
|||||||
this.e.reply(`请将账号密码用逗号隔开发送以完成绑定\n例:账号xxx@qq.com,密码xxxxx`)
|
this.e.reply(`请将账号密码用逗号隔开发送以完成绑定\n例:账号xxx@qq.com,密码xxxxx`)
|
||||||
}
|
}
|
||||||
async UserPassLogin() {
|
async UserPassLogin() {
|
||||||
let msg = this.e.msg.replace(/账号|密码|:|:/g,'').replace(/,|,/, ',').split(',');
|
let msg = this.e.msg.replace(/账号|密码|:|:/g, '').replace(/,|,/, ',').split(',');
|
||||||
if (msg.length != 2) {
|
if (msg.length != 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ export default class mysTopLogin {
|
|||||||
Bot.logger.mark("[米哈游登录] 正在验证")
|
Bot.logger.mark("[米哈游登录] 正在验证")
|
||||||
this.aigis_captcha_data = JSON.parse(res.aigis_data.data)
|
this.aigis_captcha_data = JSON.parse(res.aigis_data.data)
|
||||||
// let validate = await this.crack_geetest()
|
// let validate = await this.crack_geetest()
|
||||||
let validate = await this.user.getData("validate",this.aigis_captcha_data,false)
|
let validate = await this.user.getData("validate", this.aigis_captcha_data, false)
|
||||||
if (validate?.data?.validate) {
|
if (validate?.data?.validate) {
|
||||||
Bot.logger.mark("[米哈游登录] 验证成功")
|
Bot.logger.mark("[米哈游登录] 验证成功")
|
||||||
} else {
|
} else {
|
||||||
@ -85,25 +85,25 @@ export default class mysTopLogin {
|
|||||||
this.e.reply('接口效验失败,请重新尝试~')
|
this.e.reply('接口效验失败,请重新尝试~')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
let aigis= res.aigis_data.session_id + ";" + Buffer.from(JSON.stringify({
|
let aigis = res.aigis_data.session_id + ";" + Buffer.from(JSON.stringify({
|
||||||
geetest_challenge: validate?.data?.challenge,
|
geetest_challenge: validate?.data?.challenge,
|
||||||
geetest_seccode: validate?.data?.validate + "|jordan",
|
geetest_seccode: validate?.data?.validate + "|jordan",
|
||||||
geetest_validate: validate?.data?.validate
|
geetest_validate: validate?.data?.validate
|
||||||
})).toString("base64")
|
})).toString("base64")
|
||||||
body.headers={
|
body.headers = {
|
||||||
'x-rpc-aigis':aigis,
|
'x-rpc-aigis': aigis,
|
||||||
}
|
}
|
||||||
res = await this.user.getData("loginByPassword",body,false)
|
res = await this.user.getData("loginByPassword", body, false)
|
||||||
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(res))}`)
|
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(res))}`)
|
||||||
}
|
}
|
||||||
if (res.retcode == 0) {
|
if (res.retcode == 0) {
|
||||||
let cookies=`stoken=${res.data.token.token}&mid=${res.data.user_info.mid}`
|
let cookies = `stoken=${res.data.token.token}&mid=${res.data.user_info.mid}`
|
||||||
let cookie_token =this.user.getData("bbsGetCookie",{cookies})
|
let cookie_token = this.user.getData("bbsGetCookie", { cookies })
|
||||||
let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies};stuid=${res.data.user_info.aid};` }, false)
|
let ltoken = await this.user.getData('getLtoken', { cookies: `${cookies};stuid=${res.data.user_info.aid};` }, false)
|
||||||
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(cookie_token))}`)
|
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(cookie_token))}`)
|
||||||
return {
|
return {
|
||||||
cookie:`ltoken=${ltoken?.data?.ltoken};ltuid=${res.data.user_info.aid};cookie_token=${cookie_token?.data?.cookie_token};`,
|
cookie: `ltoken=${ltoken?.data?.ltoken};ltuid=${res.data.user_info.aid};cookie_token=${cookie_token?.data?.cookie_token};`,
|
||||||
stoken:`${cookies};stuid=${res.data.user_info.aid};`
|
stoken: `${cookies};stuid=${res.data.user_info.aid};`
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await this.e.reply(`错误:${JSON.stringify(res)}`, true)
|
await this.e.reply(`错误:${JSON.stringify(res)}`, true)
|
||||||
@ -111,13 +111,13 @@ export default class mysTopLogin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async crack_geetest() {
|
async crack_geetest() {
|
||||||
let res =await this.user.getData("microgg", this.aigis_captcha_data, false)
|
let res = await this.user.getData("microgg", this.aigis_captcha_data, false)
|
||||||
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(res))}`)
|
Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(res))}`)
|
||||||
await this.e.reply(`请完成验证:${res.shorturl}`, true)
|
await this.e.reply(`请完成验证:${res.shorturl}`, true)
|
||||||
for (let n = 1; n < 60; n++) {
|
for (let n = 1; n < 60; n++) {
|
||||||
await utils.sleepAsync(5000)
|
await utils.sleepAsync(5000)
|
||||||
try {
|
try {
|
||||||
res =await this.user.getData("microggVl", this.aigis_captcha_data, false)
|
res = await this.user.getData("microggVl", this.aigis_captcha_data, false)
|
||||||
if (res.geetest_validate) {
|
if (res.geetest_validate) {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
@ -129,12 +129,12 @@ export default class mysTopLogin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async showgoods(){
|
async showgoods() {
|
||||||
let goodslist = await this.goodsList()
|
let goodslist = await this.goodsList()
|
||||||
if(!goodslist) return false;
|
if (!goodslist) return false;
|
||||||
let msg = ['当前支持的商品有:\n']
|
let msg = ['当前支持的商品有:\n']
|
||||||
for (const [i, goods] of Object.entries(goodslist)) {
|
for (const [i, goods] of Object.entries(goodslist)) {
|
||||||
if(i=='api') continue;
|
if (i == 'api') continue;
|
||||||
let num = `${goods['goods_name']}×${(goods['goods_unit'])}` + ((goods['goods_unit']) > 0 ? goods["goods_name"] : '')
|
let num = `${goods['goods_name']}×${(goods['goods_unit'])}` + ((goods['goods_unit']) > 0 ? goods["goods_name"] : '')
|
||||||
// console.log(`ID:${i} ${num} 价格:${parseInt(goods['price']) / 100}元`)
|
// console.log(`ID:${i} ${num} 价格:${parseInt(goods['price']) / 100}元`)
|
||||||
msg.push(`ID:${i} ${num} 价格:${parseInt(goods['price']) / 100}元\n`)
|
msg.push(`ID:${i} ${num} 价格:${parseInt(goods['price']) / 100}元\n`)
|
||||||
@ -143,7 +143,7 @@ export default class mysTopLogin {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async GetCode(){
|
async GetCode() {
|
||||||
try {
|
try {
|
||||||
let msg = this.e.msg.replace(/,|,|\|/g, ' ').split(' ')
|
let msg = this.e.msg.replace(/,|,|\|/g, ' ').split(' ')
|
||||||
if (msg.length != 3) {
|
if (msg.length != 3) {
|
||||||
@ -155,12 +155,12 @@ export default class mysTopLogin {
|
|||||||
this.e.reply('uid格式不对!')
|
this.e.reply('uid格式不对!')
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let res =await this.user.getData('GetCode',{msg:this.e.msg.replace('#','')})
|
let res = await this.user.getData('GetCode', { msg: this.e.msg.replace('#', '') })
|
||||||
if(!res) return false;
|
if (!res) return false;
|
||||||
if(res?.code!=200&&res?.retcode!=0){
|
if (res?.code != 200 && res?.retcode != 0) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
this.e.reply([`uid:${res.data.uid},请使用${iswx=='weixin'?'微信':"支付宝"}扫码支付:`,segment.image(res.data.base64.replace("data:image/png;base64,", "base64://")),`\n订单号:${res['data']['order_no']}\n 价格:${(res['data']['amount'])/100}元`])
|
this.e.reply([`uid:${res.data.uid},请使用${iswx == 'weixin' ? '微信' : "支付宝"}扫码支付:`, segment.image(res.data.base64.replace("data:image/png;base64,", "base64://")), `\n订单号:${res['data']['order_no']}\n 价格:${(res['data']['amount']) / 100}元`])
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.e.reply('出问题了捏')
|
this.e.reply('出问题了捏')
|
||||||
}
|
}
|
||||||
@ -168,28 +168,28 @@ export default class mysTopLogin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async goodsList() {
|
async goodsList() {
|
||||||
let goods =await this.user.getData("goodsList")
|
let goods = await this.user.getData("goodsList")
|
||||||
if(!goods) return false;
|
if (!goods) return false;
|
||||||
return goods;
|
return goods;
|
||||||
}
|
}
|
||||||
async checkOrder(){
|
async checkOrder() {
|
||||||
let msg,uid,order_no
|
let msg, uid, order_no
|
||||||
if(!this.e.source){
|
if (!this.e.source) {
|
||||||
msg=this.e.msg.match(/\d{9,}/g)
|
msg = this.e.msg.match(/\d{9,}/g)
|
||||||
uid=msg[0],order_no=msg[1]
|
uid = msg[0], order_no = msg[1]
|
||||||
}else{
|
} else {
|
||||||
msg=this.e.source.message.match(/\d{9,}/g)
|
msg = this.e.source.message.match(/\d{9,}/g)
|
||||||
uid=msg[0],order_no=msg[1]
|
uid = msg[0], order_no = msg[1]
|
||||||
}
|
}
|
||||||
let res=await this.user.getData('checkOrder',{
|
let res = await this.user.getData('checkOrder', {
|
||||||
uid,order_no
|
uid, order_no
|
||||||
},false)
|
}, false)
|
||||||
if(!res) return false;
|
if (!res) return false;
|
||||||
if(res?.data?.status==1){
|
if (res?.data?.status == 1) {
|
||||||
this.e.reply(`uid:${uid},订单:${order_no}等待支付中`)
|
this.e.reply(`uid:${uid},订单:${order_no}等待支付中`)
|
||||||
}else if(res?.data?.status==999){
|
} else if (res?.data?.status == 999) {
|
||||||
this.e.reply(`uid:${uid},订单:${order_no}已支付完成`)
|
this.e.reply(`uid:${uid},订单:${order_no}已支付完成`)
|
||||||
}else{
|
} else {
|
||||||
this.e.reply(`订单:${order_no},${res.message}`)
|
this.e.reply(`订单:${order_no},${res.message}`)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
@ -114,7 +114,7 @@ export function recallMsg(e,r,times){
|
|||||||
if(e.group){
|
if(e.group){
|
||||||
e.group.recallMsg(r.message_id)
|
e.group.recallMsg(r.message_id)
|
||||||
}else{
|
}else{
|
||||||
e.member.recallMsg(r.message_id)
|
e.friend.recallMsg(r.message_id)
|
||||||
}
|
}
|
||||||
},1000 * times)
|
},1000 * times)
|
||||||
}
|
}
|
||||||
|
@ -8,18 +8,21 @@
|
|||||||
background-color: rgb(243, 242, 241);
|
background-color: rgb(243, 242, 241);
|
||||||
padding: 20px 0 10px 0 !important;
|
padding: 20px 0 10px 0 !important;
|
||||||
}
|
}
|
||||||
|
.topTitle table{
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
{{/block}}
|
{{/block}}
|
||||||
{{block 'main'}}
|
{{block 'main'}}
|
||||||
<div class="topTitle">
|
<div class="topTitle" style="margin: 0 auth;">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script src="{{_res_path}}/qrCode/js/jquery-1.10.2.min.js"></script>
|
<script src="{{_res_path}}/qrCode/js/jquery-1.10.2.min.js"></script>
|
||||||
<script src="{{_res_path}}/qrCode/js/jquery.qrcode.min.js"></script>
|
<script src="{{_res_path}}/qrCode/js/jquery.qrcode.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
var config = {
|
var config = {
|
||||||
width:600,//值是number类型, 表示的单位是px 必须传递
|
width:500,//值是number类型, 表示的单位是px 必须传递
|
||||||
height:600,//值是number类型, 表示的单位是px 必须传递
|
height:500,//值是number类型, 表示的单位是px 必须传递
|
||||||
text:"{{url}}".replace(/#38;/g,''),//text就表示二维码中存储的数据 必须传递
|
text:"{{url}}".replace(/#38;/g,''),//text就表示二维码中存储的数据 必须传递
|
||||||
correctLevel:2,//取值为0|1|2|3 表示二维码的纠错级别0:L/1:M/2:Q/3:H ,默认0 可选参数
|
correctLevel:2,//取值为0|1|2|3 表示二维码的纠错级别0:L/1:M/2:Q/3:H ,默认0 可选参数
|
||||||
render:"table"//取值:table/canvas , 默认table 可选参数
|
render:"table"//取值:table/canvas , 默认table 可选参数
|
||||||
|
Loading…
Reference in New Issue
Block a user