fix
这个提交包含在:
500
CGI.js
500
CGI.js
@ -1,247 +1,253 @@
|
||||
const Key = "ONLINEAICORE";
|
||||
const request = require("request");
|
||||
const Core = require("./Core");
|
||||
const net = require("net");
|
||||
const ServicePort = 8092;
|
||||
var HOOK = false;
|
||||
var Session = "";
|
||||
console.log("["+new Date().toString()+"][./Core.js]服务器已启动");
|
||||
global.DEBUG = {};
|
||||
global.DEBUG.Core = Core;
|
||||
var last = {};
|
||||
|
||||
exports.frame={
|
||||
raw: function(u,MData){
|
||||
var Req = new net.Socket();
|
||||
var KData = MData.replace("@Session",Session);
|
||||
var BData = Buffer.from(KData);
|
||||
console.log(KData)
|
||||
var MainData = `POST /${u} HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${KData.length}\r\n\r\n`;
|
||||
console.log(MainData)
|
||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||
Req.write(MainData);
|
||||
Req.write(BData);
|
||||
Req.on("data",(data)=>{
|
||||
console.log(data.toString());
|
||||
});
|
||||
Req.on("end",()=>{
|
||||
Req.end();
|
||||
});
|
||||
Req.on("close",()=>{
|
||||
Req.end();
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
SendImg: function(c,info,p){
|
||||
this.SetHook(true);
|
||||
|
||||
if(info.group != undefined){
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
group:info.group_id,
|
||||
messageChain:[{
|
||||
type:"Image",
|
||||
path:p
|
||||
}]
|
||||
});
|
||||
}else{
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
qq:info.user_id,
|
||||
messageChain:[{
|
||||
type:"Image",
|
||||
path:p
|
||||
}]
|
||||
});
|
||||
}
|
||||
var BData = Buffer.from(Kdata);
|
||||
var Ret = "";
|
||||
var To = "Friend";
|
||||
if(info.group != undefined){
|
||||
To = "Group"
|
||||
}
|
||||
var Req = new net.Socket();
|
||||
console.log(Kdata);
|
||||
console.log(Kdata);
|
||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||
Req.write(MainData);
|
||||
Req.write(BData);
|
||||
Req.on("data",(data)=>{
|
||||
console.log(data.toString());
|
||||
});
|
||||
Req.on("end",()=>{
|
||||
Req.end();
|
||||
});
|
||||
Req.on("close",()=>{
|
||||
Req.end();
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
SendURLImg: function(c,info,p){
|
||||
this.SetHook(true);
|
||||
|
||||
if(info.group != undefined){
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
group:info.group_id,
|
||||
messageChain:[{"type":"Plain","text":`IMG`},{
|
||||
type:"Image",
|
||||
url:p
|
||||
}]
|
||||
});
|
||||
}else{
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
qq:info.user_id,
|
||||
messageChain:[{"type":"Plain","text":`IMG`},{
|
||||
type:"Image",
|
||||
url:p
|
||||
}]
|
||||
});
|
||||
}
|
||||
var BData = Buffer.from(Kdata);
|
||||
var Ret = "";
|
||||
var To = "Friend";
|
||||
if(info.group != undefined){
|
||||
To = "Group"
|
||||
}
|
||||
var Req = new net.Socket();
|
||||
console.log(Kdata);
|
||||
console.log(Kdata);
|
||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||
Req.write(MainData);
|
||||
Req.write(BData);
|
||||
Req.on("data",(data)=>{
|
||||
console.log(data.toString());
|
||||
});
|
||||
Req.on("end",()=>{
|
||||
Req.end();
|
||||
});
|
||||
Req.on("close",()=>{
|
||||
Req.end();
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
SendMsg: function (connect, info, message) {
|
||||
|
||||
this.SetHook(true);
|
||||
|
||||
if(info.group != undefined){
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
group:info.group_id,
|
||||
messageChain:message
|
||||
});
|
||||
}else{
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
qq:info.user_id,
|
||||
messageChain:message
|
||||
});
|
||||
}
|
||||
var BData = Buffer.from(Kdata);
|
||||
var Ret = "";
|
||||
var To = "Friend";
|
||||
if(info.group != undefined){
|
||||
To = "Group"
|
||||
}
|
||||
var Req = new net.Socket();
|
||||
console.log(Kdata);
|
||||
console.log(Kdata);
|
||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||
Req.write(MainData);
|
||||
Req.write(BData);
|
||||
Req.on("data",(data)=>{
|
||||
console.log(data.toString());
|
||||
});
|
||||
Req.on("end",()=>{
|
||||
Req.end();
|
||||
});
|
||||
Req.on("close",()=>{
|
||||
Req.end();
|
||||
})
|
||||
});
|
||||
},
|
||||
SetHook:function(value){
|
||||
exports.HOOK = value;
|
||||
}
|
||||
}
|
||||
|
||||
var Active = ((force=false)=>{
|
||||
if(Session != "" && !force){
|
||||
return
|
||||
}
|
||||
request.post({
|
||||
url:`http://127.0.0.1:${ServicePort}/verify`,
|
||||
body:JSON.stringify({verifyKey:Key})
|
||||
},(err,res)=>{
|
||||
if(res == null){
|
||||
console.log("["+new Date().toString()+"][./Core.js]系统断线,十秒后重连");
|
||||
setTimeout(()=>{
|
||||
Active(true)
|
||||
},10000)
|
||||
return;
|
||||
}
|
||||
Session = JSON.parse(res.body).session;
|
||||
request.post({
|
||||
url:`http://127.0.0.1:${ServicePort}/bind`,
|
||||
body:JSON.stringify({
|
||||
sessionKey:Session,
|
||||
qq:2142562417
|
||||
})
|
||||
},(err2,res2)=>{
|
||||
console.log("["+new Date().toString()+"][./Core.js]Session激活成功.");
|
||||
console.log(`得到Session[${Session}]`);
|
||||
exports.HOOK = HOOK;
|
||||
var STHandle = setInterval(()=>{
|
||||
if(Session == ""){return}
|
||||
request.get({
|
||||
url:`http://127.0.0.1:${ServicePort}/fetchLatestMessage?sessionKey=${Session}&count=1`
|
||||
},(err,data)=>{
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
if(data == null || data == undefined){return}
|
||||
if(data.body.toString().substr(0,1)!="{"){return;}
|
||||
var MainData = JSON.parse(data.body);
|
||||
if(MainData == null || MainData == undefined){return};
|
||||
if(MainData.code != 0){
|
||||
console.log(MainData);
|
||||
Session = "";
|
||||
console.log(`[${new Date().toString()}][CGI.JS]MIRAI端掉线,十秒后重连`)
|
||||
clearInterval(STHandle);
|
||||
setTimeout(()=>{
|
||||
Active(true)
|
||||
},10000)
|
||||
}
|
||||
if(MainData.data == null||MainData.data == undefined){return};
|
||||
var data_obj = MainData.data[0];
|
||||
if(data_obj == undefined){return};
|
||||
if(data_obj == last){
|
||||
return
|
||||
}else{
|
||||
if(data_obj["type"]=="BotOfflineEventActive"){
|
||||
Session = "";
|
||||
console.log(`[${new Date().toString()}][CGI.JS]MIRAI端掉线,十秒后重连`)
|
||||
clearInterval(STHandle);
|
||||
setTimeout(()=>{
|
||||
Active(true)
|
||||
},10000)
|
||||
}
|
||||
Core.frame.CGI("",data_obj);
|
||||
last = data_obj;
|
||||
}
|
||||
});
|
||||
},50);
|
||||
});
|
||||
});}
|
||||
)
|
||||
|
||||
global.Active = Active;
|
||||
Active();
|
||||
const Key = "INITKEYRMl6EKk6";
|
||||
const request = require("request");
|
||||
const Core = require("./Core");
|
||||
const net = require("net");
|
||||
const ServicePort = 18095;
|
||||
var HOOK = false;
|
||||
var Session = "";
|
||||
console.log("["+new Date().toString()+"][./Core.js]服务器已启动");
|
||||
global.DEBUG = {};
|
||||
global.DEBUG.Core = Core;
|
||||
var last = {};
|
||||
|
||||
exports.frame={
|
||||
raw: function(u,MData){
|
||||
var Req = new net.Socket();
|
||||
var KData = MData.replace("@Session",Session);
|
||||
var BData = Buffer.from(KData);
|
||||
console.log(KData)
|
||||
var MainData = `POST /${u} HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${KData.length}\r\n\r\n`;
|
||||
console.log(MainData)
|
||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||
Req.write(MainData);
|
||||
Req.write(BData);
|
||||
Req.on("data",(data)=>{
|
||||
console.log(data.toString());
|
||||
});
|
||||
Req.on("end",()=>{
|
||||
Req.end();
|
||||
});
|
||||
Req.on("close",()=>{
|
||||
Req.end();
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
SendImg: function(c,info,p){
|
||||
this.SetHook(true);
|
||||
|
||||
if(info.group != undefined){
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
group:info.group_id,
|
||||
messageChain:[{
|
||||
type:"Image",
|
||||
path:p
|
||||
}]
|
||||
});
|
||||
}else{
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
qq:info.user_id,
|
||||
messageChain:[{
|
||||
type:"Image",
|
||||
path:p
|
||||
}]
|
||||
});
|
||||
}
|
||||
var BData = Buffer.from(Kdata);
|
||||
var Ret = "";
|
||||
var To = "Friend";
|
||||
if(info.group != undefined){
|
||||
To = "Group"
|
||||
}
|
||||
var Req = new net.Socket();
|
||||
console.log(Kdata);
|
||||
console.log(Kdata);
|
||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||
Req.write(MainData);
|
||||
Req.write(BData);
|
||||
Req.on("data",(data)=>{
|
||||
console.log(data.toString());
|
||||
});
|
||||
Req.on("end",()=>{
|
||||
Req.end();
|
||||
});
|
||||
Req.on("close",()=>{
|
||||
Req.end();
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
SendURLImg: function(c,info,p){
|
||||
this.SetHook(true);
|
||||
|
||||
if(info.group != undefined){
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
group:info.group_id,
|
||||
messageChain:[{"type":"Plain","text":`IMG`},{
|
||||
type:"Image",
|
||||
url:p
|
||||
}]
|
||||
});
|
||||
}else{
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
qq:info.user_id,
|
||||
messageChain:[{"type":"Plain","text":`IMG`},{
|
||||
type:"Image",
|
||||
url:p
|
||||
}]
|
||||
});
|
||||
}
|
||||
var BData = Buffer.from(Kdata);
|
||||
var Ret = "";
|
||||
var To = "Friend";
|
||||
if(info.group != undefined){
|
||||
To = "Group"
|
||||
}
|
||||
var Req = new net.Socket();
|
||||
console.log(Kdata);
|
||||
console.log(Kdata);
|
||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||
Req.write(MainData);
|
||||
Req.write(BData);
|
||||
Req.on("data",(data)=>{
|
||||
console.log(data.toString());
|
||||
});
|
||||
Req.on("end",()=>{
|
||||
Req.end();
|
||||
});
|
||||
Req.on("close",()=>{
|
||||
Req.end();
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
SendMsg: function (connect, info, message) {
|
||||
|
||||
this.SetHook(true);
|
||||
|
||||
if(info.group != undefined){
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
group:info.group_id,
|
||||
messageChain:message
|
||||
});
|
||||
}else{
|
||||
var Kdata = JSON.stringify({
|
||||
sessionKey:Session,
|
||||
qq:info.user_id,
|
||||
messageChain:message
|
||||
});
|
||||
}
|
||||
var BData = Buffer.from(Kdata);
|
||||
var Ret = "";
|
||||
var To = "Friend";
|
||||
if(info.group != undefined){
|
||||
To = "Group"
|
||||
}
|
||||
var Req = new net.Socket();
|
||||
console.log(Kdata);
|
||||
console.log(Kdata);
|
||||
var MainData = `POST /send${To}Message HTTP/1.1\r\nHost: 127.0.0.1:${ServicePort}\r\nContent-Type: application/json; charset=UTF-8;\r\nContent-Length:${BData.length}\r\n\r\n`;
|
||||
Req.connect(ServicePort,"127.0.0.1",()=>{
|
||||
Req.write(MainData);
|
||||
Req.write(BData);
|
||||
Req.on("data",(data)=>{
|
||||
console.log(data.toString());
|
||||
});
|
||||
Req.on("end",()=>{
|
||||
Req.end();
|
||||
});
|
||||
Req.on("close",()=>{
|
||||
Req.end();
|
||||
})
|
||||
});
|
||||
},
|
||||
SetHook:function(value){
|
||||
exports.HOOK = value;
|
||||
}
|
||||
}
|
||||
|
||||
var Active = ((force=false)=>{
|
||||
if(Session != "" && !force){
|
||||
return
|
||||
}
|
||||
request.post({
|
||||
url:`http://127.0.0.1:${ServicePort}/verify`,
|
||||
headers:{
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body:JSON.stringify({verifyKey:Key})
|
||||
},(err,res)=>{
|
||||
if(res == null){
|
||||
console.log("["+new Date().toString()+"][./Core.js]系统断线,十秒后重连");
|
||||
setTimeout(()=>{
|
||||
Active(true)
|
||||
},10000)
|
||||
return;
|
||||
}
|
||||
Session = JSON.parse(res.body).session;
|
||||
request.post({
|
||||
url:`http://127.0.0.1:${ServicePort}/bind`,
|
||||
headers:{
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body:JSON.stringify({
|
||||
sessionKey:Session,
|
||||
qq:2142562417
|
||||
})
|
||||
},(err2,res2)=>{
|
||||
console.log("["+new Date().toString()+"][./Core.js]Session激活成功.");
|
||||
console.log(`得到Session[${Session}]`);
|
||||
exports.HOOK = HOOK;
|
||||
var STHandle = setInterval(()=>{
|
||||
if(Session == ""){return}
|
||||
request.get({
|
||||
url:`http://127.0.0.1:${ServicePort}/fetchLatestMessage?sessionKey=${Session}&count=1`
|
||||
},(err,data)=>{
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
if(data == null || data == undefined){return}
|
||||
if(data.body.toString().substr(0,1)!="{"){return;}
|
||||
var MainData = JSON.parse(data.body);
|
||||
if(MainData == null || MainData == undefined){return};
|
||||
if(MainData.code != 0){
|
||||
console.log(MainData);
|
||||
Session = "";
|
||||
console.log(`[${new Date().toString()}][CGI.JS]MIRAI端掉线,十秒后重连`)
|
||||
clearInterval(STHandle);
|
||||
setTimeout(()=>{
|
||||
Active(true)
|
||||
},10000)
|
||||
}
|
||||
if(MainData.data == null||MainData.data == undefined){return};
|
||||
var data_obj = MainData.data[0];
|
||||
if(data_obj == undefined){return};
|
||||
if(data_obj == last){
|
||||
return
|
||||
}else{
|
||||
if(data_obj["type"]=="BotOfflineEventActive"){
|
||||
Session = "";
|
||||
console.log(`[${new Date().toString()}][CGI.JS]MIRAI端掉线,十秒后重连`)
|
||||
clearInterval(STHandle);
|
||||
setTimeout(()=>{
|
||||
Active(true)
|
||||
},10000)
|
||||
}
|
||||
Core.frame.CGI("",data_obj);
|
||||
last = data_obj;
|
||||
}
|
||||
});
|
||||
},50);
|
||||
});
|
||||
});}
|
||||
)
|
||||
|
||||
global.Active = Active;
|
||||
Active();
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
{
|
||||
"AI":{
|
||||
"Allow":true,
|
||||
"FindIn":"fs",
|
||||
"Path":"AI.js"
|
||||
},
|
||||
"远程执行测试": {
|
||||
"Allow": false,
|
||||
"FindIn": "fs",
|
||||
@ -54,10 +59,5 @@
|
||||
"Allow":true,
|
||||
"FindIn":"fs",
|
||||
"Path":"农村.js"
|
||||
},
|
||||
"GeoGeBra":{
|
||||
"Allow":true,
|
||||
"FindIn":"fs",
|
||||
"Path":"GeoGeBra.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
{"固定资产":{"80000000":10000,"862869995":1550,"927980270":426387,"1285908631":500,"2044792347":23245,"2142562417":10000,"2284888681":899,"2645989614":550,"2868445034":1050,"3054331058":1100,"3162625498":26979,"3491504564":26623,"3569808588":1000,"@927980270":10000},"利息":{"862869995":"20206","927980270":"20231","2645989614":"20206","2868445034":"20206","3054331058":"20207","3162625498":"20230","3491504564":"20230"},"领工资":{"862869995":"202063","927980270":"202324","2284888681":"202064","2868445034":"202064","3054331058":"202072","3162625498":"202302","3491504564":"202313","3569808588":"202066"},"签到":{"862869995":"202063","927980270":"202324","1285908631":"202061","2044792347":"2022104","2284888681":"202064","2645989614":"202064","2868445034":"202061","3054331058":"202072","3162625498":"202302","3491504564":"202313","3569808588":"202066"},"RedPacketPool":20209,"SandBox":{"新春":"{\"927980270\":true,\"2044792347\":true,\"3162625498\":true}","a":"1"},"目标":{"3162625498":"927980270"},"AITalk":{"927980270":true,"2868445034":false,"3491504564":false,"Core":false},"板砖":{"927980270":0,"2044792347":null},"公会系统":{"927980270":"共学社"},"AIEnable":{"545541668":true,"588932037":true,"744368753":false,"776148636":true,"963936042":true,"966138955":true,"1012022482":true},"保镖[2022 0 3]":{"927980270":3},"保镖[2022 0 5]":{"927980270":5}}
|
||||
{"固定资产":{"80000000":10000,"862869995":1550,"927980270":471672,"1285908631":500,"2044792347":23245,"2142562417":10000,"2284888681":899,"2645989614":550,"2868445034":1050,"3054331058":1100,"3162625498":26979,"3491504564":26623,"3569808588":1000,"@927980270":10000},"利息":{"862869995":"20206","927980270":"202511","2645989614":"20206","2868445034":"20206","3054331058":"20207","3162625498":"20230","3491504564":"20230"},"领工资":{"862869995":"202063","927980270":"2025115","2284888681":"202064","2868445034":"202064","3054331058":"202072","3162625498":"202302","3491504564":"202313","3569808588":"202066"},"签到":{"862869995":"202063","927980270":"2025116","1285908631":"202061","2044792347":"2022104","2284888681":"202064","2645989614":"202064","2868445034":"202061","3054331058":"202072","3162625498":"202302","3491504564":"202313","3569808588":"202066"},"RedPacketPool":19257,"SandBox":{"新春":"{\"927980270\":true,\"2044792347\":true,\"3162625498\":true}","a":"1"},"目标":{"3162625498":"927980270"},"AITalk":{"927980270":true,"2868445034":false,"3491504564":false,"Core":false},"板砖":{"927980270":0,"2044792347":null},"公会系统":{"927980270":"共学社"},"AIEnable":{"545541668":true,"588932037":true,"744368753":false,"776148636":true,"963936042":true,"966138955":true,"1012022482":true},"保镖[2022 0 3]":{"927980270":3},"保镖[2022 0 5]":{"927980270":5}}
|
||||
在新工单中引用
屏蔽一个用户