修改.gitignore
这个提交包含在:
84
.gitignore
vendored
普通文件
84
.gitignore
vendored
普通文件
@ -0,0 +1,84 @@
|
|||||||
|
#OnlineAI
|
||||||
|
!\Addons\List.json
|
||||||
|
*.json
|
||||||
|
!List.json
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
151
AI.js
普通文件
151
AI.js
普通文件
@ -0,0 +1,151 @@
|
|||||||
|
const https = require('http');
|
||||||
|
const Core = require("./Core");
|
||||||
|
const request = require('request');
|
||||||
|
|
||||||
|
const crypto = require('crypto');
|
||||||
|
const md5 = crypto.createHash('md5');
|
||||||
|
//const iconv = require('iconv-lite');
|
||||||
|
var ret = "";
|
||||||
|
const R = "_";
|
||||||
|
exports.add={
|
||||||
|
Interfaces:{
|
||||||
|
GetAITalk:function(user){
|
||||||
|
if(Core.frame.ReadSystemConfig("AITalk")[user] != true){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
console.log(Core.HOOK);
|
||||||
|
var message0 = new String(info["message"]);
|
||||||
|
if(message0 == "智能聊天"){
|
||||||
|
if(!exports.add.Interfaces.GetAITalk("Core")){
|
||||||
|
Core.frame.SendMsg(connect,info,"请联系AI管理员(发送\"AI管理员\"查看)开启智能聊天功能。")
|
||||||
|
}
|
||||||
|
temp = Core.frame.ReadSystemConfig("AITalk");
|
||||||
|
if(exports.add.Interfaces.GetAITalk(Core.GetUser(info["user_id"]))){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(Core.GetUser(info["user_id"]))},我们不是一直在聊吗?`)
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(Core.GetUser(info["user_id"]))},现在你已经开启智能聊天了。`)
|
||||||
|
}
|
||||||
|
temp[Core.GetUser(info["user_id"])] = true;
|
||||||
|
Core.frame.WriteSystemConfig("AITalk",temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(message0 == "停止聊天"){
|
||||||
|
if(!exports.add.Interfaces.GetAITalk("Core")){
|
||||||
|
Core.frame.SendMsg(connect,info,"请联系AI管理员(发送\"AI管理员\"查看)开启智能聊天功能。")
|
||||||
|
}
|
||||||
|
temp = Core.frame.ReadSystemConfig("AITalk");
|
||||||
|
if(exports.add.Interfaces.GetAITalk(Core.GetUser(info["user_id"]))){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(Core.GetUser(info["user_id"]))},哼,不理你了。`)
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(Core.GetUser(info["user_id"]))},谁愿意和你聊啊!`)
|
||||||
|
}
|
||||||
|
temp[Core.GetUser(info["user_id"])] = false;
|
||||||
|
Core.frame.WriteSystemConfig("AITalk",temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
info["message"] = info["message"].replace("[CQ:at,qq=2142562417]","");
|
||||||
|
|
||||||
|
if(Core.HOOK == true){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!exports.add.Interfaces.GetAITalk(Core.GetUser(info["user_id"]))&&info["raw_message"].indexOf("[CQ:at,qq=2142562417]")==-1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const https = require('http');
|
||||||
|
//const Core = require("./Core");
|
||||||
|
const request = require('request');
|
||||||
|
const crypto = require('crypto');
|
||||||
|
const md5 = crypto.createHash('md5');
|
||||||
|
var kee = new String(info["message"]);
|
||||||
|
|
||||||
|
for(;kee.indexOf("?")!=-1;){
|
||||||
|
kee = kee.replace("?","?");
|
||||||
|
}
|
||||||
|
for(;kee.indexOf("!")!=-1;){
|
||||||
|
kee = kee.replace("!","!");
|
||||||
|
}
|
||||||
|
for(;kee.indexOf(" ")!=-1;){
|
||||||
|
kee = kee.replace(" "," ");
|
||||||
|
}
|
||||||
|
var params = new Object({
|
||||||
|
app_id:"2125346185",
|
||||||
|
time_stamp: Date.parse(new Date())/1000,
|
||||||
|
"nonce\_str":new String("A"+Math.floor(Math.random() * 100000000)),
|
||||||
|
session:Core.GetUser(info["user_id"]),
|
||||||
|
question:kee
|
||||||
|
});
|
||||||
|
var key = "T6zpC15OkWJ9jP0a";
|
||||||
|
var p2 = new Object();
|
||||||
|
var k = Object.keys(params).sort();
|
||||||
|
for(var i = 0;i<k.length;i++){
|
||||||
|
p2[k[i]] = params[k[i]];
|
||||||
|
}
|
||||||
|
var Str="";
|
||||||
|
for(var i = 0;i<k.length;i++){
|
||||||
|
Str=Str+Object.keys(p2)[i]+"="+encodeURI(Object.values(p2)[i])+"&";
|
||||||
|
}
|
||||||
|
Str = Str+"app_key="+key;
|
||||||
|
sign = md5.update(Str).digest("hex").toUpperCase();
|
||||||
|
params["sign"] = sign;
|
||||||
|
request.get({
|
||||||
|
url:`https://api.ai.qq.com/fcgi-bin/nlp/nlp_textchat?${Str}&sign=${sign}`,
|
||||||
|
encoding:'utf8'
|
||||||
|
},(err,req,body)=>{
|
||||||
|
if(req.statusCode==200){
|
||||||
|
console.log(body);
|
||||||
|
var an = JSON.parse(body)["data"]["answer"];
|
||||||
|
Core.frame._SendMsg(connect,info,an)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
https.get(`http://api.qingyunke.com/api.php?key=free&appid=0&msg=${encodeURI(message0)}`,(resp) => {
|
||||||
|
let data = '';
|
||||||
|
resp.on('data', (chunk) => {
|
||||||
|
data += chunk;
|
||||||
|
});
|
||||||
|
resp.on('end', () => {
|
||||||
|
console.log(data);
|
||||||
|
if(data.substr(0,1)!="{"){
|
||||||
|
Core.frame.SendMsg(connect,info,ret);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ret = new String(JSON.parse(data).content);
|
||||||
|
for(;ret.match("{br}")!=null;){
|
||||||
|
ret = ret.replace("{br}","\\r\\n");
|
||||||
|
}
|
||||||
|
console.log(ret);
|
||||||
|
Core.frame.SendMsg(connect,info,ret)
|
||||||
|
});
|
||||||
|
}).on("error", (err) => {
|
||||||
|
console.log("Error: " + err.message);
|
||||||
|
});
|
||||||
|
*///这个是未经测试的版本
|
||||||
|
|
||||||
|
/*Yige.ai暂停运营
|
||||||
|
*request.post({
|
||||||
|
url:'http://www.yige.ai/v1/query',
|
||||||
|
form:{
|
||||||
|
token:"ED1A14F0606567943CC354351A9E6B0E",
|
||||||
|
query:info["message"],
|
||||||
|
session_id:Core.GetUser(info["user_id"])
|
||||||
|
},
|
||||||
|
encoding:'utf8'
|
||||||
|
},function(error,response,body){
|
||||||
|
if(response.statusCode == 200){
|
||||||
|
console.log(body);
|
||||||
|
var ret = JSON.parse(body).answer;
|
||||||
|
if(ret != "[ERROR]无回复"){
|
||||||
|
Core.frame._SendMsg(connect,info,ret);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
});
|
||||||
|
*
|
||||||
|
*/
|
||||||
0
AIService/AI.py
普通文件
0
AIService/AI.py
普通文件
35
AddOns.js
普通文件
35
AddOns.js
普通文件
@ -0,0 +1,35 @@
|
|||||||
|
//这是插件系统的支持库
|
||||||
|
//作者:蓝树叶
|
||||||
|
const Core = require("./Core");
|
||||||
|
const fs = require("fs");
|
||||||
|
exports.add = {
|
||||||
|
Interfaces:{
|
||||||
|
GetAddons:function(message){
|
||||||
|
var msg = new String(message);
|
||||||
|
var data = new Object(JSON.parse(fs.readFileSync("./Addons/List.json").toString()));
|
||||||
|
var keys = Object.keys(data);
|
||||||
|
for(var i=0;i<keys.length;i++){
|
||||||
|
if(msg.substr(0,keys[i].length) == keys[i]){
|
||||||
|
Core.frame.SetHOOK(true);
|
||||||
|
return [new String(data[keys[i]]),msg.substr(keys[i].length,msg.length - keys[i].length)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ["void.js",""];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
var s = exports.add.Interfaces.GetAddons(info["message"]);
|
||||||
|
console.log(s);
|
||||||
|
console.log(`./Addons/${s[0]}`);
|
||||||
|
try{
|
||||||
|
require(`./Addons/${s[0]}`).add.Control(connect,s[1],Core.GetUser(info["user_id"]),info);
|
||||||
|
}catch(err){
|
||||||
|
console.log(err);
|
||||||
|
Core.frame.SendMsg(connect,info,err);
|
||||||
|
}
|
||||||
|
if(new String(info["message"]).substr(0,4)=="斗罗大陆"){
|
||||||
|
Core.frame.SetHOOK(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
4
Addons/List.json
普通文件
4
Addons/List.json
普通文件
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"PVP":"PVP/Main.js",
|
||||||
|
"MUL":"PVP/Multi.js"
|
||||||
|
}
|
||||||
304
Addons/PVP/Main.js
普通文件
304
Addons/PVP/Main.js
普通文件
@ -0,0 +1,304 @@
|
|||||||
|
const Core = require("./../../Core");
|
||||||
|
const fs = require("fs");
|
||||||
|
exports.add = {
|
||||||
|
Interfaces:{
|
||||||
|
/*GetPath:function(dir){
|
||||||
|
return `./Addons/PVP/${dir}`;
|
||||||
|
}*/
|
||||||
|
},
|
||||||
|
Control:function(connect,message,user,info){
|
||||||
|
var msg = new String(message);
|
||||||
|
console.log("0");
|
||||||
|
if(msg.substr(0,2)=="购买"){
|
||||||
|
msg = msg.replace("购买","");
|
||||||
|
console.log("1");
|
||||||
|
fs.readFile("./Addons/PVP/DataBase.json",(err,data)=>{
|
||||||
|
var data_obj = JSON.parse(data.toString())
|
||||||
|
if(data_obj["PVP"]["物品"][msg]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,"没有这样的物品。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err2,data2)=>{
|
||||||
|
var data2_obj = JSON.parse(data2.toString());
|
||||||
|
if(data2_obj[user]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,"没有你的账户,发送\\\"PVP注册\\\"注册账户!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(var i=0;i<data2_obj[user]["仓库"].length;i++){
|
||||||
|
if(data2_obj[user]["仓库"][i]==msg){
|
||||||
|
Core.frame.SendMsg(connect,info,"你已经有这个物品了");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(data_obj["PVP"]["物品"][msg]["价格"]==null){
|
||||||
|
Core.frame.SendMsg(connect,info,"这是非卖品");
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(data2_obj[user]["余额"]<data_obj["PVP"]["物品"][msg]["价格"]){
|
||||||
|
Core.frame.SendMsg(connect,info,"你的PVP代币不足");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data2_obj[user]["余额"] = data2_obj[user]["余额"] - data_obj["PVP"]["物品"][msg]["价格"];
|
||||||
|
data2_obj[user]["仓库"][data2_obj[user]["仓库"].length] = msg;
|
||||||
|
fs.writeFile("./Addons/PVP/UserData.json",JSON.stringify(data2_obj),(err3)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,"购买成功");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(msg=="我的物品"){
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
data_obj = JSON.parse(data.toString());
|
||||||
|
if(data_obj[user]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,"没有你的账户,发送\\\"PVP注册\\\"注册账户!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var Str = `你的物品`;
|
||||||
|
for(var i=0;i<data_obj[user]["仓库"].length;i++){
|
||||||
|
Str = Str + "\\r\\n" + `${i+1}.`+ data_obj[user]["仓库"][i];
|
||||||
|
};
|
||||||
|
Core.frame.SendMsg(connect,info,Str);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg.substr(0,2)=="装备"){
|
||||||
|
var item = msg.replace("装备","");
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
if(data_obj[user]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},你暂未注册PVP插件,请发送"PVP注册"。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(data_obj[user]["装备"]==item){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},你已经装备此物品,请勿重复装备。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(var i=0;i<data_obj[user]["仓库"].length;i++){
|
||||||
|
if(item == data_obj[user]["仓库"][i]){
|
||||||
|
data_obj[user]["装备"] = item;
|
||||||
|
fs.writeFile("./Addons/PVP/UserData.json",JSON.stringify(data_obj),(err)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},装备物品${item}成功!`);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},你没有物品${item}。`);
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(msg=="注册"){
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
data_obj = new Object(JSON.parse(data.toString()));
|
||||||
|
if(data_obj[user]!=undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,"你已经注册了账户。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data_obj[user]={"余额":1000,"装备":"木制剑","仓库":["木制剑"]}
|
||||||
|
fs.writeFile("./Addons/PVP/UserData.json",JSON.stringify(data_obj),(err2)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,"注册成功,获得系统赠送1000枚PVP代币以及一把木制剑。");
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(msg.substr(0,4)=="查看物品"){
|
||||||
|
msg = msg.replace("查看物品","");
|
||||||
|
msg = msg.replace("[CQ:at,qq=","");
|
||||||
|
msg = msg.replace(" ","");
|
||||||
|
msg = msg.replace("]","");
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
data_obj = new Object(JSON.parse(data.toString()));
|
||||||
|
if(data_obj[msg]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(msg)}没有注册PVP。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var Str = `${Core.frame.At(msg)}的物品`;
|
||||||
|
for(var i=0;i<data_obj[msg]["仓库"].length;i++){
|
||||||
|
Str = Str + "\\r\\n" + `${i+1}.`+ data_obj[msg]["仓库"][i];
|
||||||
|
};
|
||||||
|
Core.frame.SendMsg(connect,info,Str);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(msg.substr(0,2)=="对战"){
|
||||||
|
msg = msg.replace("对战","");
|
||||||
|
msg = msg.replace("[CQ:at,qq=","");
|
||||||
|
msg = msg.replace(" ","");
|
||||||
|
msg = msg.replace("]","");
|
||||||
|
if(user==msg){
|
||||||
|
Core.frame.SendMsg(connect,info,"不能和自己进行PVP!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(msg=="2142562417"){
|
||||||
|
Core.frame.SendMsg(connect,info,"萌萌还不会PVP呢");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
data_obj = new Object(JSON.parse(data.toString()));
|
||||||
|
if(data_obj[user]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,`你没有注册PVP。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(data_obj[msg]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(msg)}没有注册PVP。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(data_obj[user]["Playing"]!=undefined&&data_obj[user]["Playing"]!=-1){
|
||||||
|
Core.frame.SendMsg(connect,info,`你正与其他人PVP中。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(data_obj[msg]["Playing"]!=undefined&&data_obj[msg]["Playing"]!=-1){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(msg)}正在与其他人PVP中。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(data_obj[user]["Saving"]==true){
|
||||||
|
Core.frame.SendMsg(connect,info,`你在保护状态中,不可PVP,发送\\"PVP解除保护\\"来结束保护`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(data_obj[msg]["Saving"]==true){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(msg)}正处于保护状态中。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data_obj["#PVPROOM"][data_obj["#PVPROOM"].length] = {"P1":{"ID":user.toString(),"HP":100,"Hold":"Attacked"},"P2":{"ID":msg.toString(),"HP":100,"Hold":"Attacked"}};
|
||||||
|
data_obj[user]["Playing"] = data_obj["#PVPROOM"].length-1;
|
||||||
|
data_obj[msg]["Playing"] = data_obj["#PVPROOM"].length-1;
|
||||||
|
fs.writeFile("./Addons/PVP/UserData.json",JSON.stringify(data_obj),(err)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,"PVP设定完成,发送相关PVP指令来进行PVP吧。");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(msg=="攻击"){
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
data_obj = new Object(JSON.parse(data.toString()));
|
||||||
|
if(data_obj[user]["Playing"]!=undefined&&data_obj[user]["Playing"]!=-1){
|
||||||
|
//DoNothing();
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},你没有进行PVP!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var room = data_obj["#PVPROOM"][data_obj[user]["Playing"]];
|
||||||
|
|
||||||
|
if(room["P1"]["ID"]==user){
|
||||||
|
var thisPlayerID = "P1";
|
||||||
|
var OtherPlayerID = "P2";
|
||||||
|
}
|
||||||
|
if(room["P2"]["ID"]==user){
|
||||||
|
var OtherPlayerID = "P1";
|
||||||
|
var thisPlayerID = "P2";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(room[thisPlayerID]["Hold"]!="Attacked"){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},你已经攻击过了;请等待其他玩家攻击。`);
|
||||||
|
return;
|
||||||
|
}else{
|
||||||
|
room[thisPlayerID]["Hold"]="DoAttacked";
|
||||||
|
}
|
||||||
|
if(room[OtherPlayerID]["Hold"]!="Attacked"){
|
||||||
|
room[thisPlayerID]["Hold"]="Attacked";
|
||||||
|
room[OtherPlayerID]["Hold"]="Attacked";
|
||||||
|
}
|
||||||
|
var thisPlayerWeapon = data_obj[user]["装备"];
|
||||||
|
fs.readFile("./Addons/PVP/DataBase.json",(err,data2)=>{
|
||||||
|
data2_obj = JSON.parse(data2.toString());
|
||||||
|
var WeaponInfo = data2_obj["PVP"]["物品"][thisPlayerWeapon];
|
||||||
|
if(WeaponInfo["加成"]["我方"]==undefined){
|
||||||
|
var 我方加成 = {"Att":0,"Def":0};
|
||||||
|
}else{
|
||||||
|
var 我方加成 = WeaponInfo["加成"]["我方"];
|
||||||
|
}
|
||||||
|
if(WeaponInfo["加成"]["敌方"]==undefined){
|
||||||
|
var 敌方加成 = {"Att":0,"Def":0};
|
||||||
|
}else{
|
||||||
|
var 敌方加成 = WeaponInfo["加成"]["敌方"];
|
||||||
|
}
|
||||||
|
if(我方加成["Att"]==undefined){
|
||||||
|
我方加成["Att"] = 0;
|
||||||
|
}
|
||||||
|
if(我方加成["Def"]==undefined){
|
||||||
|
我方加成["Def"] = 0;
|
||||||
|
}
|
||||||
|
if(敌方加成["Att"]==undefined){
|
||||||
|
我方加成["Att"] = 0;
|
||||||
|
}
|
||||||
|
if(敌方加成["Def"]==undefined){
|
||||||
|
敌方加成["Def"] = 0;
|
||||||
|
}
|
||||||
|
var 我方总攻击 =Math.floor( 20 * (1 + 0.01 * 我方加成["Att"]) * Math.random() - 5 * (1 + 0.01 * 敌方加成["Def"]) * Math.random() * 0.5);
|
||||||
|
|
||||||
|
room[OtherPlayerID]["HP"] = new Number(room[OtherPlayerID]["HP"]) - 我方总攻击;
|
||||||
|
console.log("A");
|
||||||
|
var Umsg = `${Core.frame.At(user)},你使用了${thisPlayerWeapon}对${Core.frame.At(room[OtherPlayerID]["ID"])}进行打击,扣除对方${我方总攻击}点血量,对方剩余${room[OtherPlayerID]["HP"]}`
|
||||||
|
console.log("B");
|
||||||
|
console.log("HPI");
|
||||||
|
console.log(new Number(room[OtherPlayerID]["HP"]));
|
||||||
|
console.log(new Number(room[OtherPlayerID]["HP"]).valueOf()>0);
|
||||||
|
if(!(new Number(room[OtherPlayerID]["HP"]).valueOf()>0)){
|
||||||
|
console.log("HPI");
|
||||||
|
console.log(new Number(room[OtherPlayerID]["HP"]));
|
||||||
|
var temp = data_obj[user]["Playing"];
|
||||||
|
data_obj[user]["Playing"] = undefined;
|
||||||
|
data_obj[room[OtherPlayerID]["ID"]]["Playing"] = undefined;
|
||||||
|
Umsg = `${Umsg}\\r\\n${Core.frame.At(user)},${Core.frame.At(room[OtherPlayerID]["ID"])}已战败。`;
|
||||||
|
data_obj[room[OtherPlayerID]["ID"]]["Saving"] = true;
|
||||||
|
room = {};
|
||||||
|
data_obj["#PVPROOM"][temp] = room;
|
||||||
|
}
|
||||||
|
console.log("C");
|
||||||
|
data_obj["#PVPROOM"][data_obj[user]["Playing"]] = room;
|
||||||
|
fs.writeFile("./Addons/PVP/UserData.json",JSON.stringify(data_obj),(err)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,`${Umsg}\\r\\nPVP信息保存成功!\\r\\nPVP插件作者:蓝树叶`);
|
||||||
|
console.log("E");
|
||||||
|
});
|
||||||
|
console.log("D");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(msg=="删档"){
|
||||||
|
if(!require("./../../Debug.js").add.Interfaces.IsAdmin(user)){
|
||||||
|
Core.frame.SendMsg(connect,info,"只有管理员才有权执行此命令。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
data_obj = JSON.parse(data.toString());
|
||||||
|
data_obj["#PVPROOM"] = [];
|
||||||
|
fs.writeFile("./Addons/PVP/UserData.json",JSON.stringify(data_obj),(err)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,"删除临时数据完成!");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(msg=="投降"){
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
if(data_obj[user]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,`你没有注册PVP。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(data_obj[user]["Playing"]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,`你没有进行PVP。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var P1 = data_obj["#PVPROOM"][data_obj[user]["Playing"]]["P1"];
|
||||||
|
var P2 = data_obj["#PVPROOM"][data_obj[user]["Playing"]]["P2"];
|
||||||
|
data_obj[P1["ID"]]["Playing"] = -1;
|
||||||
|
data_obj[P2["ID"]]["Playing"] = -1;
|
||||||
|
fs.writeFile("./Addons/PVP/UserData.json",JSON.stringify(data_obj),(err2)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,"投降成功!");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(msg=="解除保护"){
|
||||||
|
fs.readFile("./Addons/PVP/UserData.json",(err,data)=>{
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
if(data_obj[user]["Saving"]==true){
|
||||||
|
data_obj[user]["Saving"] = false;
|
||||||
|
fs.writeFile("./Addons/PVP/UserData.json",JSON.stringify(data_obj),(err2)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,"解除保护成功,现在你可以PVP了!");
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,"你本来就没有被保护。");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//Core.frame.SendMsg(connect,info,"PVP插件暂未开发。");
|
||||||
|
}
|
||||||
|
}
|
||||||
61
Addons/PVP/Multi.js
普通文件
61
Addons/PVP/Multi.js
普通文件
@ -0,0 +1,61 @@
|
|||||||
|
const Core = require("./../../Core");
|
||||||
|
const fs = require("fs");
|
||||||
|
exports.add = {
|
||||||
|
Interfaces:{
|
||||||
|
/*GetPath:function(dir){
|
||||||
|
return `./Addons/PVP/${dir}`;
|
||||||
|
}*/
|
||||||
|
},
|
||||||
|
Control:function(connect,message,user,info){
|
||||||
|
var msg = new String(message);
|
||||||
|
if(msg=="创建队伍"){
|
||||||
|
fs.readFile("./Addons/PVP/MulBase.json",(err,data)=>{
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
if(data_obj["Player"][user]==undefined){
|
||||||
|
data_obj["Player"][user]={"Team":-1};
|
||||||
|
}else{
|
||||||
|
if(data_obj["Player"][user]["Team"]!=-1){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(Core.GetUser(user))},你已经加入一个队伍了。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var teams = new Array(data_obj["Team"]);
|
||||||
|
data_obj["Player"][user]["Team"]=teams.length;
|
||||||
|
data_obj["Player"][user]["ID"]=1;
|
||||||
|
teams[teams.length] = [{"Attacking":-1,"Owner":user},{"ID":user,"Attacked":false,"HP":100,"PP":100}];
|
||||||
|
data_obj["Team"]=teams;
|
||||||
|
fs.writeFile("./Addons/PVP/MulBase.json",JSON.stringify(data_obj),(err2)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},队伍创建成功,队伍ID为${data_obj["Player"][user]["Team"]}。`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(msg.substr(0,4)=="加入队伍"){
|
||||||
|
var teamId = new Number(msg.replace("加入队伍",""));
|
||||||
|
fs.readFile("./Addons/PVP/MulBase.json",(err,data)=>{
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
if(data_obj["Player"][user]==undefined){
|
||||||
|
data_obj["Player"][user]={"Team":-1};
|
||||||
|
}else{
|
||||||
|
if(data_obj["Player"][user]["Team"]!=-1){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(Core.GetUser(user))},你已经加入一个队伍了。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var teams = new Array(data_obj["Team"]);
|
||||||
|
if(teams.length<new Number(teamId)){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},没有这个Mul-PVP队伍。`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var theTeam = new Array(teams[new Number(teamId)]);
|
||||||
|
theTeam[theTeam.length] = {"ID":user,"Attacked":false,"HP":100,"PP":100};
|
||||||
|
data_obj["Player"][user]["Team"] = new Number(teamId);
|
||||||
|
data_obj["Player"][user]["ID"] = theTeam.length - 1;
|
||||||
|
teams[teamId] = theTeam;
|
||||||
|
data_obj["Team"] = teams;
|
||||||
|
fs.writeFile("./Addons/PVP/MulBase.json",JSON.stringify(data_obj),(err2)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(user)},加入队伍${teamId}成功!`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
114
Addons/PVZ/Main.js
普通文件
114
Addons/PVZ/Main.js
普通文件
@ -0,0 +1,114 @@
|
|||||||
|
const Core = require("./../../Core");
|
||||||
|
const fs = require("fs");
|
||||||
|
const efs = function(dir,info,call){
|
||||||
|
console.log(`写入${info}到${dir}`);
|
||||||
|
fs.writeFile(dir,info,call);
|
||||||
|
}
|
||||||
|
var PVZStart = false;
|
||||||
|
var GameMain = function(connect,info){
|
||||||
|
var data_obj = JSON.parse(fs.readFileSync("./Addons/PVZ/GameData.json").toString());
|
||||||
|
for(var i=0;i<64;i++){
|
||||||
|
if(data_obj["Area"][i]==undefined){
|
||||||
|
data_obj["Area"][i] = {};
|
||||||
|
}
|
||||||
|
var temp = data_obj["Area"][i]
|
||||||
|
if(temp!=undefined){
|
||||||
|
if(temp["Plant"]!=undefined&&temp["Plant"]!="NoThing"){
|
||||||
|
for(var j=0;j<temp["Plant"]["Weapon"].length;j++){
|
||||||
|
if(temp["Plant"]["Weapon"][j]["LastTimer"]!=0&&temp["Plant"]["Weapon"][j]["LastTimer"]!=undefined){
|
||||||
|
temp["Plant"]["Weapon"][j]["LastTimer"] = temp["Plant"]["Weapon"][j]["LastTimer"] - 1;
|
||||||
|
}else{
|
||||||
|
temp["Plant"]["Weapon"][j]["LastTimer"] = temp["Plant"]["Weapon"][j]["Timer"];
|
||||||
|
if(temp["Plant"]["Weapon"][j]["Type"]=="Launcher"){
|
||||||
|
var k= Math.floor(i/8);
|
||||||
|
for(var n=0;n<8;n++){
|
||||||
|
if(data_obj["Area"][k*8+n]["Zombie"]!=undefined){
|
||||||
|
data_obj["Area"][k*8+n]["Zombie"]["HP"] = data_obj["Area"][k*8+n]["Zombie"]["HP"] - temp["Plant"]["Weapon"][j]["Settings"]["Hurt"];
|
||||||
|
if(data_obj["Area"][k*8+n]["Zombie"]["HP"]<0){
|
||||||
|
Core.frame.SendMsg(connect,info,`位于${i}的${temp["Plant"]["Name"]}击败了位于${k*8+n}的${data_obj["Area"][k*8+n]["Zombie"]["Name"]}`);
|
||||||
|
data_obj["Area"][k*8+n]["Zombie"] = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(temp["Plant"]["Weapon"][j]["Type"]=="PowerMaker"){
|
||||||
|
data_obj["Power"] = data_obj["Power"] + temp["Plant"]["Weapon"][j]["Settings"]["Count"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(temp["Zombie"]!=undefined){
|
||||||
|
if(temp["Zombie"]["MoveTimer"]!=undefined&&temp["Zombie"]["MoveTimer"]!=0){
|
||||||
|
temp["Zombie"]["MoveTimer"] = temp["Zombie"]["MoveTimer"] - 1;
|
||||||
|
}else{
|
||||||
|
temp["Zombie"]["MoveTimer"] = temp["Zombie"]["Speed"];
|
||||||
|
var k=Math.floor(i/8)*8;
|
||||||
|
if(i-1<k){
|
||||||
|
Core.frame.SendMsg(connect,info,`位于${i}的僵尸进入你的家。`);
|
||||||
|
}else{
|
||||||
|
data_obj["Area"][i-1]["Zombie"] = temp["Zombie"];
|
||||||
|
temp["Zombie"] = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data_obj["Area"][i] = temp;
|
||||||
|
}
|
||||||
|
efs("./Addons/PVZ/GameData.json",JSON.stringify(data_obj),(err)=>{});
|
||||||
|
}
|
||||||
|
exports.add = {
|
||||||
|
Interfaces:{
|
||||||
|
/*GetPath:function(dir){
|
||||||
|
return `./Addons/PVP/${dir}`;
|
||||||
|
}*/
|
||||||
|
},
|
||||||
|
Control:function(connect,message,user,info){
|
||||||
|
var msg = new String(message);
|
||||||
|
if(msg.substr(0,4)=="进行游戏"){
|
||||||
|
time = new Number(msg.replace("进行游戏",""));
|
||||||
|
PVZStart = true;
|
||||||
|
setInterval(()=>{
|
||||||
|
if(PVZStart == true){
|
||||||
|
GameMain(connect,info);
|
||||||
|
}
|
||||||
|
},time*1000);
|
||||||
|
Core.frame.SendMsg(connect,info,`已开始PVZ游戏`)
|
||||||
|
};
|
||||||
|
if(msg=="结束游戏"){
|
||||||
|
PVZStart = false;
|
||||||
|
Core.frame.SendMsg(connect,info,"已结束PVZ。");
|
||||||
|
};
|
||||||
|
if(msg.substr(0,2)=="种植"){
|
||||||
|
var plant = msg.replace("种植","");
|
||||||
|
if(plant.indexOf("||")==-1){
|
||||||
|
Core.frame.SendMsg(connect,info,"请使用||将植物与位置分开。")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var temp = plant.split("||");
|
||||||
|
fs.readFile("./Addons/PVZ/DataBase.json",(err,data)=>{
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
if(data_obj["Plant"][temp[0]]==undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,`没有${temp[0]}这个植物!!!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(temp[1]<0&&temp[1]>64){
|
||||||
|
Core.frame.SendMsg(connect,info,`没有${temp[1]}这个格子。`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.readFile("./Addons/PVZ/GameData.json",(err2,data2)=>{
|
||||||
|
var data2_obj = JSON.parse(data2.toString());
|
||||||
|
if(data2_obj["Area"][temp[1]]==undefined){
|
||||||
|
data2_obj["Area"][temp[1]] = {};
|
||||||
|
}
|
||||||
|
if(data2_obj["Area"][temp[1]]["Plant"]!=undefined&&data2_obj["Area"][temp[1]]["Plant"]!="NoThing"){
|
||||||
|
Core.frame.SendMsg(connect,info,`${temp[1]}已经有植物了。`);
|
||||||
|
}
|
||||||
|
data2_obj["Area"][temp[1]]["Plant"] = data_obj["Plant"][temp[0]];
|
||||||
|
efs("./Addons/PVZ/GameData.json",JSON.stringify(data2_obj),(err3)=>{
|
||||||
|
Core.frame.SendMsg(connect,info,`种植${temp[0]}到${temp[1]}成功!`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Addons/void.js
普通文件
8
Addons/void.js
普通文件
@ -0,0 +1,8 @@
|
|||||||
|
exports.add = {
|
||||||
|
Interfaces:{
|
||||||
|
|
||||||
|
},
|
||||||
|
Control:function(connect,message,user){
|
||||||
|
console.log(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
29
AutoCreeper.js
普通文件
29
AutoCreeper.js
普通文件
@ -0,0 +1,29 @@
|
|||||||
|
const Core = require("./Core");
|
||||||
|
exports.add={
|
||||||
|
InterFaces:{
|
||||||
|
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
if(info["message"]=="Creeper?"){
|
||||||
|
Core.frame.SendMsg(connect,info,"awww man!");
|
||||||
|
}
|
||||||
|
if(info["message"]=="awww man!"){
|
||||||
|
Core.frame.SendMsg(connect,info,"So we back in the mine.");
|
||||||
|
}
|
||||||
|
if(info["message"]=="So we back in the mine."){
|
||||||
|
Core.frame.SendMsg(connect,info,"Got are pickaxr swingin' from side to side");
|
||||||
|
}
|
||||||
|
if(info["message"]=="Side to Side"){
|
||||||
|
Core.frame.SendMsg(connect,info,"Side side to side");
|
||||||
|
}
|
||||||
|
if(info["message"]=="Side side to Side"){
|
||||||
|
Core.frame.SendMsg(connect,info,"Night night diamonds tonight");
|
||||||
|
}
|
||||||
|
if(info["message"]=="Night night diamonds tonight"){
|
||||||
|
Core.frame.SendMsg(connect,info,"Heads up.");
|
||||||
|
}
|
||||||
|
if(info["message"]=="Heads up."){
|
||||||
|
Core.frame.SendMsg(connect,info,"You hear a sound turn around and look up");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
CGI.js
普通文件
35
CGI.js
普通文件
@ -0,0 +1,35 @@
|
|||||||
|
const ws = require("websocket");
|
||||||
|
const fs = require("fs");
|
||||||
|
const Core = require("./Core");
|
||||||
|
var wss = new ws.client();
|
||||||
|
var HOOK = false;
|
||||||
|
wss.connect("ws://127.0.0.1:6700/");
|
||||||
|
console.log("["+new Date().toString()+"][./Core.js]服务器已启动\r\n");
|
||||||
|
exports.HOOK = HOOK;
|
||||||
|
exports.frame={
|
||||||
|
SendMsg:function(connect,info,message){
|
||||||
|
this.SetHook(true);
|
||||||
|
if(message == undefined||message == ""){
|
||||||
|
this.SendMsg(connect,info,"[ERROR]Ai出现了一些问题。并没有接受到回复。")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(info["message_type"]=="group"){
|
||||||
|
var m = `{"action":"send_group_msg","params":{"group_id":`+info["group_id"]+`,"message":"`+message+`"}}`;
|
||||||
|
}else if(info["message_type"]=="private"){
|
||||||
|
var m = `{"action":"send_private_msg","params":{"user_id":`+info["user_id"]+`,"message":"`+message+`"}}`
|
||||||
|
}
|
||||||
|
console.log(m);
|
||||||
|
connect.send(m);
|
||||||
|
},
|
||||||
|
SetHook:function(value){
|
||||||
|
exports.HOOK = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wss.on("connect",(connect)=>{
|
||||||
|
exports.connect = connect;
|
||||||
|
exports.frame.SetHook(false);
|
||||||
|
exports.HOOK = HOOK;
|
||||||
|
connect.on("message",(data)=>{
|
||||||
|
Core.frame.CGI(connect,JSON.parse(data.utf8Data));
|
||||||
|
});
|
||||||
|
});
|
||||||
86
Core.js
普通文件
86
Core.js
普通文件
@ -0,0 +1,86 @@
|
|||||||
|
const JSCGI = require("./CGI");
|
||||||
|
const fs = require("fs");
|
||||||
|
var package = ["./Debug.js","./Money.js","./RedPacket.js","./抢劫.js","./公会系统.js","./AutoCreeper.js","./Frame.js","./AddOns.js","./板砖.js","./DocMaker.js","./狗屁不通文章生成器.js"];
|
||||||
|
//var HOOK = false;
|
||||||
|
exports.GetUser=function(user_id){
|
||||||
|
if(!fs.existsSync("./cname.json")){
|
||||||
|
fs.writeFile("./cname.json",JSON.stringify({}),(err)=>{
|
||||||
|
console.log(`[${new Date().toString()}][Core.js]cname.json初始化完成!`);
|
||||||
|
});
|
||||||
|
return user_id;
|
||||||
|
}
|
||||||
|
var data = JSON.parse(fs.readFileSync("./cname.json").toString());
|
||||||
|
if(data[user_id]!=undefined){
|
||||||
|
return data[user_id];
|
||||||
|
}else{
|
||||||
|
return user_id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.HOOK = JSCGI.HOOK;
|
||||||
|
exports.frame={
|
||||||
|
__Ban:function(connect,group,someone,time){
|
||||||
|
connect.send(`{"action":"set_group_ban","params":{"group_id":"${group}","user_id":"${someone}","duration":${time}}}`);
|
||||||
|
},
|
||||||
|
_Ban:function(connect,info,user,time){
|
||||||
|
this.__Ban(connect,info["group_id"],user,time);
|
||||||
|
},
|
||||||
|
Ban:function(connect,info,time){
|
||||||
|
this._Ban(connect,info,info["user_id"],time);
|
||||||
|
},
|
||||||
|
SetHOOK:function(value){
|
||||||
|
JSCGI.frame.SetHook(value);
|
||||||
|
exports.HOOK = JSCGI.HOOK;
|
||||||
|
},
|
||||||
|
SendMsg:function(connect,info,message){
|
||||||
|
this.SetHOOK(true);
|
||||||
|
if(message==undefined){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JSCGI.frame.SendMsg(connect,info,message);
|
||||||
|
},
|
||||||
|
_SendMsg:function(connect,info,message){
|
||||||
|
this.SendMsg(connect,info,message);
|
||||||
|
},
|
||||||
|
At:function(user_id){
|
||||||
|
return "[CQ:at,qq="+user_id+"]";
|
||||||
|
},
|
||||||
|
ReadSystemConfig(Name){
|
||||||
|
var temp = JSON.parse(fs.readFileSync("UserDataBase.json").toString())
|
||||||
|
if(temp[Name]==undefined){
|
||||||
|
return {};
|
||||||
|
}else{
|
||||||
|
return temp[Name];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
WriteSystemConfig(Name,Value){
|
||||||
|
var Data = JSON.parse(fs.readFileSync("UserDataBase.json").toString());
|
||||||
|
Data[Name] = Value;
|
||||||
|
//console.log(Data);
|
||||||
|
fs.writeFileSync("UserDataBase.json",JSON.stringify(Data));
|
||||||
|
return 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
CGI:function(connect,info){
|
||||||
|
console.log("["+new Date().toString()+"][./Core.js]收到新消息");
|
||||||
|
exports.HOOK = JSCGI.HOOK;
|
||||||
|
exports.frame.SetHOOK(false);
|
||||||
|
exports.HOOK = false;
|
||||||
|
if(info.message==undefined){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
for(var i=0;i<package.length;i++){
|
||||||
|
console.log(`[${new Date().toString()}][${package[i]}]正在处理`);
|
||||||
|
require(package[i]).add.Control(connect,info);
|
||||||
|
console.log(`[${new Date().toString()}][${package[i]}]处理完成`);
|
||||||
|
}
|
||||||
|
if(require("./AI.js").add.Interfaces.GetAITalk("Core")){
|
||||||
|
require("./AI.js").add.Control(connect,info);
|
||||||
|
}
|
||||||
|
}catch(error){
|
||||||
|
exports.frame.SendMsg(connect,info,error);
|
||||||
|
console.log(error);
|
||||||
|
};
|
||||||
|
console.log("["+new Date().toString()+"][./Core.js]线程处理完毕\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
184
Debug.js
普通文件
184
Debug.js
普通文件
@ -0,0 +1,184 @@
|
|||||||
|
//这是Debug用的OnlineAI扩展包,只允许AI管理员使用此扩展包里面的"执行代码"方法
|
||||||
|
const fs=require("fs");
|
||||||
|
const Core = require("./Core");
|
||||||
|
const child_p = require("child_process");
|
||||||
|
var SandBox = Core.frame.ReadSystemConfig("SandBox");
|
||||||
|
exports.add={
|
||||||
|
Interfaces:{
|
||||||
|
IsAdmin:function(user){
|
||||||
|
if(!fs.existsSync("./Debug.json")){
|
||||||
|
fs.writeFile("./Debug.json",JSON.stringify({}),(err)=>{
|
||||||
|
console.log(`[${new Date().toString()}][Debug.js]加载Debug.json成功!`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var data = JSON.parse(fs.readFileSync("./Debug.json").toString());
|
||||||
|
if(data[user] == true){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ExecutePython:function(command,info){
|
||||||
|
fs.writeFile(".\\ExecuteDir\\Python.py",command,()=>{
|
||||||
|
child_p.exec("python .\\ExecuteDir\\Python.py",(err,std)=>{
|
||||||
|
console.error(err);
|
||||||
|
console.log(std);
|
||||||
|
var n = std;
|
||||||
|
for(;n.match("\r\n");){
|
||||||
|
n = n.replace("\r\n","\\r\\n");
|
||||||
|
}
|
||||||
|
Core.frame.SendMsg(Core.connect,info,n);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ExecuteCmd:function(command,info){
|
||||||
|
fs.writeFile(".\\ExecuteDir\\cmd.cmd",command,()=>{
|
||||||
|
child_p.exec(".\\ExecuteDir\\cmd.cmd",(err,std)=>{
|
||||||
|
console.error(err);
|
||||||
|
console.log(std);
|
||||||
|
var n = std;
|
||||||
|
for(;n.match("\r\n");){
|
||||||
|
n = n.replace("\r\n","\\r\\n");
|
||||||
|
}
|
||||||
|
Core.frame.SendMsg(Core.connect,info,n);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
},
|
||||||
|
ExecutePHP:function(command,info){
|
||||||
|
fs.writeFile(".\\ExecuteDir\\PHP.PHP",command,()=>{
|
||||||
|
child_p.exec("PHP-win.exe .\\ExecuteDir\\PHP.PHP",(err,std)=>{
|
||||||
|
console.error(err);
|
||||||
|
console.log(std);
|
||||||
|
var n = std;
|
||||||
|
for(;n.match("\r\n");){
|
||||||
|
n = n.replace("\r\n","\\r\\n");
|
||||||
|
}
|
||||||
|
Core.frame.SendMsg(Core.connect,info,n);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
const Debug = {
|
||||||
|
log:function(msg){
|
||||||
|
msg = new String(msg);
|
||||||
|
msg = msg.replace("\n","\\r\\n");
|
||||||
|
Core.frame.SendMsg(connect,info,msg);
|
||||||
|
console.log("["+new Date().toString()+"][Debug.js]"+msg);
|
||||||
|
},
|
||||||
|
SaveVar:function(){
|
||||||
|
var n = Object.keys(SandBox);
|
||||||
|
for(var i=0;i<n.length;i++){
|
||||||
|
SandBox[n[i]]=SandBox[n[i]].toString();
|
||||||
|
};
|
||||||
|
Core.frame.WriteSystemConfig("SandBox",SandBox);
|
||||||
|
},
|
||||||
|
LoadVar:function(){
|
||||||
|
SandBox = Core.frame.ReadSystemConfig("SandBox");
|
||||||
|
var n = Object.keys(SandBox);
|
||||||
|
for(var i=0;i<n.length;i++){
|
||||||
|
if(new String(SandBox[n[i]]).substr(0,8)=="function"){
|
||||||
|
eval("SandBox[\""+n[i]+"\"] = "+SandBox[n[i]]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
AddMoney:function(user,money){
|
||||||
|
require("./Money").add.Interfaces.GiveUserMoney(user,money);
|
||||||
|
Debug.log("[Debug.js]指令执行完毕。")
|
||||||
|
},
|
||||||
|
ExecutePython:function(command){
|
||||||
|
exports.add.Interfaces.ExecutePython(command,info);
|
||||||
|
},
|
||||||
|
ExecuteCmd:function(command){
|
||||||
|
exports.add.Interfaces.ExecuteCmd(command,info);
|
||||||
|
},
|
||||||
|
ExecutePHP:function(command){
|
||||||
|
exports.add.Interfaces.ExecutePHP(command,info);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
//console.log("["+new Date().toString()+"][Debug.js]正在处理");
|
||||||
|
Debug.LoadVar();
|
||||||
|
var Temp1 = new String(info["raw_message"]);
|
||||||
|
if(Temp1 == "AI管理员"){
|
||||||
|
var data = new Object(JSON.parse(fs.readFileSync("./Debug.json").toString()));
|
||||||
|
var aia = Object.keys(data);
|
||||||
|
var message = "目前有权管理AI的人员如下:";
|
||||||
|
for(var i=0;i<aia.length;i++){
|
||||||
|
message = message + "\\r\\n" + `${i+1}.` +aia[i];
|
||||||
|
}
|
||||||
|
Core.frame.SendMsg(connect,info,message);
|
||||||
|
}
|
||||||
|
if(Temp1.substr(0,4)=="执行代码"){
|
||||||
|
if(!exports.add.Interfaces.IsAdmin(Core.GetUser(info["user_id"]))){
|
||||||
|
Core.frame.SendMsg(connect,info,"此功能只允许机器人管理员使用。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var command = Temp1.replace("执行代码","");
|
||||||
|
command = command.replace("[","[");
|
||||||
|
command = command.replace("]","]");
|
||||||
|
command = command.replace("&","&");
|
||||||
|
try{
|
||||||
|
eval(command);
|
||||||
|
}catch(error){
|
||||||
|
Core.frame.SendMsg(connect,info,error);
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
Debug.SaveVar();
|
||||||
|
Core.frame.SendMsg(connect,info,"指令执行完毕。");
|
||||||
|
};
|
||||||
|
|
||||||
|
if(Temp1 == "说明书"||Temp1 == "用户手册"||Temp1 == "帮助"){
|
||||||
|
Core.frame.SendMsg(connect,info,`[CQ:share,url=${"https://docs.qq.com/doc/DRXNQU0ZtRlVBSFpn"},title=${"OnlineAI说明书"},content=${"实时更新的官方OnlineAI说明书"},image=${"https://docs.idqqimg.com/tim/docs/desktop/font/packages/desktop/src/page/index/components/silder/logo/logo-96d180.svg"}]`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!fs.existsSync("./Message.json")){
|
||||||
|
fs.writeFile("./Message.json",JSON.stringify({}),(err)=>{
|
||||||
|
console.log(`[${new Date().toString()}][Debug.js]Message.json创建完毕。`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.readFile("./Message.json",(err,data)=>{
|
||||||
|
var data2 = JSON.parse(data.toString());
|
||||||
|
if(data2[info["message"]]!=undefined){
|
||||||
|
Core.frame.SendMsg(connect,info,data2[info["message"]]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(Temp1.substr(0,3)=="指令+"){
|
||||||
|
Core.frame.SetHOOK(true);
|
||||||
|
if(!exports.add.Interfaces.IsAdmin(Core.GetUser(info["user_id"]))){
|
||||||
|
Core.frame.SendMsg(connect,info,"此功能只允许机器人管理员使用。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Temp1 = Temp1.replace("指令+","");
|
||||||
|
Temp2 = Temp1.split("+");
|
||||||
|
Core.frame.SetHOOK(true);
|
||||||
|
fs.readFile("./Message.json",(err,data)=>{
|
||||||
|
var data2 = JSON.parse(data.toString());
|
||||||
|
data2[Temp2[0]] = Temp2[1];
|
||||||
|
fs.writeFile("./Message.json",JSON.stringify(data2),()=>{
|
||||||
|
Core.frame.SendMsg(connect,info,"指令创建完毕。");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Temp1.substr(0,3)=="指令-"){
|
||||||
|
Core.frame.SetHOOK(true);
|
||||||
|
if(!exports.add.Interfaces.IsAdmin(Core.GetUser(info["user_id"]))){
|
||||||
|
Core.frame.SendMsg(connect,info,"此功能只允许机器人管理员使用。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Temp1 = Temp1.replace("指令-","");
|
||||||
|
fs.readFile("./Message.json",(err,data)=>{
|
||||||
|
var data2 = JSON.parse(data.toString());
|
||||||
|
data2[Temp1] = undefined;
|
||||||
|
Core.frame.SendMsg();
|
||||||
|
fs.writeFile("./Message.json",JSON.stringify(data2),()=>{
|
||||||
|
Core.frame.SendMsg(connect,info,"指令删除完毕。");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log("["+new Date().toString()+"][Debug.js]处理完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Debuger.js
普通文件
14
Debuger.js
普通文件
@ -0,0 +1,14 @@
|
|||||||
|
const net = require("net");
|
||||||
|
var s = new net.Socket();
|
||||||
|
s.connect(10293,"1.tcp.cpolar.io");
|
||||||
|
s.on("connect",()=>{
|
||||||
|
s.on("data",(data)=>{
|
||||||
|
var d_obj = new Object(JSON.parse(data.toString()));
|
||||||
|
|
||||||
|
if(d_obj["message"]=="测试"){
|
||||||
|
d_obj["msg"]="[DEBUG]测试";
|
||||||
|
console.log(d_obj);
|
||||||
|
s.write(JSON.stringify(d_obj));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
24
DocMaker.js
普通文件
24
DocMaker.js
普通文件
@ -0,0 +1,24 @@
|
|||||||
|
const btoa = require("btoa");
|
||||||
|
const Core = require("./Core");
|
||||||
|
const request = require('request');
|
||||||
|
exports.add = {
|
||||||
|
Interfaces:{
|
||||||
|
MakeURL:function(docs){
|
||||||
|
var e = {"TITLE":"本文档生成自OnlineAI Core","Context":[{"Text":docs}]};
|
||||||
|
var s = JSON.stringify(e);
|
||||||
|
var n = encodeURIComponent(s);
|
||||||
|
var k = btoa(n);
|
||||||
|
return `http://111.229.158.234/JsonDoc/?${k}`;
|
||||||
|
},
|
||||||
|
GetShortURL:function(LongURL){
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
if(info["message"].substr(0,4)=="生成文档"){
|
||||||
|
var msg = info["message"].replace("生成文档","");
|
||||||
|
var url = exports.add.Interfaces.MakeURL(msg);
|
||||||
|
Core.frame.SendMsg(connect,info,`${url}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
ExecuteDir/Python.py
普通文件
2
ExecuteDir/Python.py
普通文件
@ -0,0 +1,2 @@
|
|||||||
|
import os
|
||||||
|
print(os.system('systeminfo'))
|
||||||
1
ExecuteDir/cmd.cmd
普通文件
1
ExecuteDir/cmd.cmd
普通文件
@ -0,0 +1 @@
|
|||||||
|
ipconfig
|
||||||
36
Frame.js
普通文件
36
Frame.js
普通文件
@ -0,0 +1,36 @@
|
|||||||
|
const Core = require("./Core");
|
||||||
|
const net = require("net");
|
||||||
|
var ES_Server;
|
||||||
|
var ES_Socket = [/*new net.Socket()*/];
|
||||||
|
exports.add = {
|
||||||
|
Interfaces:{
|
||||||
|
|
||||||
|
},
|
||||||
|
Init:function(connect){
|
||||||
|
ES_Server = new net.Server();
|
||||||
|
ES_Server.on("connection",(socket)=>{
|
||||||
|
ES_Socket[ES_Socket.length] = socket
|
||||||
|
socket.on("data",(data)=>{
|
||||||
|
var data_obj = JSON.parse(data.toString());
|
||||||
|
Core.frame.SendMsg(connect,data_obj,data_obj["msg"]);
|
||||||
|
});
|
||||||
|
socket.on("end",()=>{
|
||||||
|
socket.end();
|
||||||
|
});
|
||||||
|
socket.on("close",()=>{
|
||||||
|
socket.end();
|
||||||
|
});
|
||||||
|
socket.on("error",(err)=>{
|
||||||
|
//console.log(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ES_Server.listen(9632,"0.0.0.0");
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
for(var i=0;i<ES_Socket.length;i++){
|
||||||
|
if(ES_Socket[i].readable){
|
||||||
|
ES_Socket[i].write(JSON.stringify(info));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
37
LICENSE
普通文件
37
LICENSE
普通文件
@ -0,0 +1,37 @@
|
|||||||
|
The Open Source license Of 《OnlineAI Core》
|
||||||
|
《OnlineAI核心》的开源协议
|
||||||
|
|
||||||
|
Auother:Lanshuye
|
||||||
|
作者:蓝树叶
|
||||||
|
|
||||||
|
Studio:Computer Internet Studio.,
|
||||||
|
工作室:电脑网络工作室
|
||||||
|
|
||||||
|
|
||||||
|
If you want to use,copy,modify or purchase this
|
||||||
|
program(《Online AI Core》), you must agree to this license.
|
||||||
|
如果您想使用、复制、修改或购买本程序(《Online Ai Core》),您必
|
||||||
|
须同意本许可证。
|
||||||
|
|
||||||
|
If you don't agree to this license, please don't use,copy,m-
|
||||||
|
odify or purchase this program and you must delete this pro-
|
||||||
|
gram immediately.
|
||||||
|
如果您不同意此许可证,请不要使用、复制、修改或购买此程序并立即删除
|
||||||
|
此程序。
|
||||||
|
|
||||||
|
When you agree this license, you can modify this program,but
|
||||||
|
you have to public the changed sources in your own version
|
||||||
|
open-sourcely and mark original author.
|
||||||
|
当您同意此许可证时,您可以修改此程序,但必须以开源被修改的代码的方
|
||||||
|
式公开您自己的版本并标注原作者。
|
||||||
|
|
||||||
|
And You can't charge for your own version.
|
||||||
|
以及你不能为自己的版本收费。
|
||||||
|
|
||||||
|
You are able to copy this program according to this license
|
||||||
|
to other computer when you agree to this license.
|
||||||
|
当您同意此许可证时,您可以根据此许可证将此程序复制到其他计算机。
|
||||||
|
|
||||||
|
The final interpretation right of this document belongs to
|
||||||
|
Computer Internet Studio.
|
||||||
|
本文档最终解释权归电脑网络工作室所有。
|
||||||
0
ModrenWar/HELP
普通文件
0
ModrenWar/HELP
普通文件
二进制
ModulesList
普通文件
二进制
ModulesList
普通文件
二进制文件未显示。
117
Money.js
普通文件
117
Money.js
普通文件
@ -0,0 +1,117 @@
|
|||||||
|
//固定资产
|
||||||
|
const fs=require("fs");
|
||||||
|
const Core = require("./Core");
|
||||||
|
exports.add={
|
||||||
|
Interfaces:{
|
||||||
|
GetUserMoney:function(UserID){
|
||||||
|
var data = Core.frame.ReadSystemConfig("固定资产");
|
||||||
|
if(data[UserID]==undefined||null||NaN){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return new Number(data[UserID]) + 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
GiveUserMoney:function(UserID,Moeny){
|
||||||
|
var data = Core.frame.ReadSystemConfig("固定资产");
|
||||||
|
if(data[UserID]==undefined||null||NaN){
|
||||||
|
data[UserID] = Moeny;
|
||||||
|
}else{
|
||||||
|
data[UserID] = new Number(this.GetUserMoney(UserID) + new Number(Moeny));
|
||||||
|
}
|
||||||
|
Core.frame.WriteSystemConfig("固定资产",data);
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
CostUserMoney:function(UserID,Moeny){
|
||||||
|
exports.add.Interfaces.GiveUserMoney(UserID,-1 * Moeny);
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
GetUserTo:function(UserID){
|
||||||
|
var data = Core.frame.ReadSystemConfig("目标");
|
||||||
|
if(data[UserID]==undefined||null||NaN){
|
||||||
|
return undefined;
|
||||||
|
}else{
|
||||||
|
return data[UserID];
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
GiveUserTo:function(UserID,To){
|
||||||
|
var data = Core.frame.ReadSystemConfig("目标");
|
||||||
|
data[UserID] = To;
|
||||||
|
Core.frame.WriteSystemConfig("目标",data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
//console.log("["+new Date().toString()+"][Money.js]正在处理");
|
||||||
|
var data = JSON.parse(fs.readFileSync("./UserDataBase.json"));
|
||||||
|
const date = new Date();
|
||||||
|
var msg = new String(info["raw_message"]);
|
||||||
|
if(msg=="签到"||msg.substr(0,8)=="[CQ:sign"){
|
||||||
|
if(data["签到"][Core.GetUser(info["user_id"])]==date.getFullYear().toString()+date.getMonth().toString()+date.getDay().toString()){
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"已签到了!");
|
||||||
|
}else{
|
||||||
|
exports.add.Interfaces.GiveUserMoney(Core.GetUser(info["user_id"]),500);
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"签到成功,获得500RMB,当前余额"+exports.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"])));
|
||||||
|
var data = JSON.parse(fs.readFileSync("./UserDataBase.json"));
|
||||||
|
data["签到"][Core.GetUser(info["user_id"])]=date.getFullYear().toString()+date.getMonth().toString()+date.getDay().toString();
|
||||||
|
fs.writeFileSync("./UserDataBase.json",JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(msg=="领利息"||msg.substr(0,8)=="[CQ:sign"){
|
||||||
|
if(data["利息"][Core.GetUser(info["user_id"])]==date.getFullYear().toString()+date.getMonth().toString()){
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"一个月只能领一次利息!");
|
||||||
|
}else{
|
||||||
|
var m = Math.floor(new Number(exports.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"]))) * 0.1);
|
||||||
|
exports.add.Interfaces.GiveUserMoney(Core.GetUser(info["user_id"]),m);
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+`领取成功,获得${m}RMB,当前余额`+exports.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"])));
|
||||||
|
var data = JSON.parse(fs.readFileSync("./UserDataBase.json"));
|
||||||
|
data["利息"][Core.GetUser(info["user_id"])]=date.getFullYear().toString()+date.getMonth().toString();
|
||||||
|
fs.writeFileSync("./UserDataBase.json",JSON.stringify(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(info["raw_message"]=="我的余额"){
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"你的余额是"+exports.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"]))+"元。");
|
||||||
|
}
|
||||||
|
if(msg.substr(0,2)=="转账"){
|
||||||
|
if(msg.length==2){
|
||||||
|
Core.frame.SendMsg(connect,info,"此命令的格式是:转账ZH@XXXX(XXXX为接受方) 或 转账JEXXXX(XXXX为钱数)");
|
||||||
|
}else{
|
||||||
|
if(msg.substr(0,4)=="转账ZH"){
|
||||||
|
var UQQ = msg.replace('[CQ:at,qq=',"");
|
||||||
|
UQQ = UQQ.replace(']',"");
|
||||||
|
UQQ = UQQ.replace('转账ZH',"");
|
||||||
|
UQQ = UQQ.replace(' ',"")
|
||||||
|
exports.add.Interfaces.GiveUserTo(Core.GetUser(info["user_id"]),UQQ);
|
||||||
|
Core.frame.SendMsg(connect,info,"已设置目标为"+Core.frame.At(UQQ));
|
||||||
|
}
|
||||||
|
if(msg.substr(0,4)=="转账JE"){
|
||||||
|
//var UM = msg.replace('[CQ:at,qq=',"");
|
||||||
|
//UM = UM.replace(']',"");
|
||||||
|
UM = UM.replace('转账JE',"");
|
||||||
|
UM = UM.replace(' ',"")
|
||||||
|
UM = new Number(UM);
|
||||||
|
if(UM<0){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入一个正数金额。");
|
||||||
|
}else if(UM==0){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入一个正数金额。");
|
||||||
|
}else if(isNaN(UM)){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入一个数字。");
|
||||||
|
}else if(exports.add.Interfaces.GetUserTo(Core.GetUser(info["user_id"]))!=undefined){
|
||||||
|
if(exports.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"]))<UM){
|
||||||
|
Core.frame.SendMsg(connect,info,"你的余额不足转账。");
|
||||||
|
}else{
|
||||||
|
exports.add.Interfaces.CostUserMoney(Core.GetUser(info["user_id"]),UM);
|
||||||
|
exports.add.Interfaces.GiveUserMoney(exports.add.Interfaces.GetUserTo(Core.GetUser(info["user_id"])),UM);
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"转账成功,你的余额:"+exports.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"]))+"元。对方余额:"+exports.add.Interfaces.GetUserMoney(exports.add.Interfaces.GetUserTo(Core.GetUser(info["user_id"])))+"元。"); exports.add.Interfaces.GiveUserTo(Core.GetUser(info["user_id"]),undefined);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,"请使用 转账ZH@XXXX 设置转账目标。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//console.log("["+new Date().toString()+"][Money.js]处理完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
16
OnlineAI.js
普通文件
16
OnlineAI.js
普通文件
@ -0,0 +1,16 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const cp = require("child_process");
|
||||||
|
if(fs.existsSync("./CGI.js")){
|
||||||
|
fs.exists("./UserDataBase.json",(ex)=>{
|
||||||
|
if(ex){
|
||||||
|
console.log(`[${new Date().toString()}][OnlineAI.js]载入"UserDataBase.js"成功!`);
|
||||||
|
}else{
|
||||||
|
fs.writeFile("./UserDataBase.json",JSON.stringify({}),(err)=>{
|
||||||
|
console.log(`[${new Date().toString()}][OnlineAI.js]用户信息初始化完成!`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
require("./CGI.js");
|
||||||
|
}else{
|
||||||
|
console.log("请下载OnlineAI Core核心功能包。");
|
||||||
|
}
|
||||||
0
README.en.md
普通文件
0
README.en.md
普通文件
65
RedPacket.js
普通文件
65
RedPacket.js
普通文件
@ -0,0 +1,65 @@
|
|||||||
|
//红包Mod
|
||||||
|
const fs=require("fs");
|
||||||
|
const Core = require("./Core");
|
||||||
|
const MoneyInterfaces = require("./Money").add.Interfaces;
|
||||||
|
exports.add={
|
||||||
|
Interfaces:{
|
||||||
|
GetRedPacketPool:function(){
|
||||||
|
var RPP = Core.frame.ReadSystemConfig("RedPacketPool");
|
||||||
|
if(RPP==undefined){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return RPP;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
AddRedPacketPool:function(Money){
|
||||||
|
var RPP = this.GetRedPacketPool();
|
||||||
|
var RPP = RPP + Money;
|
||||||
|
Core.frame.WriteSystemConfig("RedPacketPool",RPP);
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
CostRedPacketPool:function(Money){
|
||||||
|
this.AddRedPacketPool(-1 * Money);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
//console.log("["+new Date().toString()+"][RedPacket.js]正在处理");
|
||||||
|
var data = JSON.parse(fs.readFileSync("./UserDataBase.json"));
|
||||||
|
const date = new Date();
|
||||||
|
var Temp1 = new String(info["raw_message"]);
|
||||||
|
if(Temp1.substr(0,3)=="发红包"){
|
||||||
|
if(Temp1.length==3){
|
||||||
|
Core.frame.SendMsg(connect,info,"命令使用规范:发红包XX(XX为红包金额)");
|
||||||
|
}else{
|
||||||
|
var Temp2 = new Number(Temp1.substr(3,Temp1.length-3));
|
||||||
|
var UM = Temp2;
|
||||||
|
if(UM<0){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入一个正数金额。");
|
||||||
|
}else if(UM==0){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入一个正数金额。");
|
||||||
|
}else if(isNaN(UM)){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入一个数字。");
|
||||||
|
}
|
||||||
|
if(MoneyInterfaces.GetUserMoney(Core.GetUser(info["user_id"]))<Temp2){
|
||||||
|
Core.frame.SendMsg(connect,info,"你的余额不够。");
|
||||||
|
}else{
|
||||||
|
MoneyInterfaces.CostUserMoney(Core.GetUser(info["user_id"]),Temp2);
|
||||||
|
exports.add.Interfaces.AddRedPacketPool(Temp2);
|
||||||
|
Core.frame.SendMsg(connect,info,"发红包成功!红包池余额:"+exports.add.Interfaces.GetRedPacketPool());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(Temp1 == "抢红包"){
|
||||||
|
if(exports.add.Interfaces.GetRedPacketPool()<1000){
|
||||||
|
var M = exports.add.Interfaces.GetRedPacketPool();
|
||||||
|
}else{
|
||||||
|
var M = Math.ceil(1000 * Math.random());
|
||||||
|
}
|
||||||
|
MoneyInterfaces.GiveUserMoney(Core.GetUser(info["user_id"]),M);
|
||||||
|
exports.add.Interfaces.CostRedPacketPool(M);
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"你抢到了"+M+"元,红包池余额"+exports.add.Interfaces.GetRedPacketPool()+"元");
|
||||||
|
}
|
||||||
|
//console.log("["+new Date().toString()+"][RedPacket.js]处理完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Server/CGI.php
普通文件
3
Server/CGI.php
普通文件
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
die("{\"Allow\":false}")
|
||||||
|
?>
|
||||||
11
Server/index.css
普通文件
11
Server/index.css
普通文件
@ -0,0 +1,11 @@
|
|||||||
|
*{
|
||||||
|
margin:0px;
|
||||||
|
}
|
||||||
|
#UserInfo{
|
||||||
|
width:100%;
|
||||||
|
height:5%;
|
||||||
|
background-color:#CCCCCC79;
|
||||||
|
}
|
||||||
|
#Body{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
45
Server/index.html
普通文件
45
Server/index.html
普通文件
@ -0,0 +1,45 @@
|
|||||||
|
<html lang="Zh-cn">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>首页</title>
|
||||||
|
<link rel="stylesheet" href="index.css">
|
||||||
|
<script>
|
||||||
|
|
||||||
|
var User;
|
||||||
|
var UserInfo;
|
||||||
|
//var AJAX = new XMLHttpRequest();
|
||||||
|
window.onload = function(){
|
||||||
|
UserInfo = document.getElementById("UserInfo");
|
||||||
|
if(localStorage.getItem("User")==undefined){
|
||||||
|
var User = {"ID":"Visitor"};
|
||||||
|
UserInfo.getElementsByClassName("UserName").item(0).innerHTML = "游客账户";
|
||||||
|
UserInfo.getElementsByClassName("Link").item(0).innerHTML = "登录";
|
||||||
|
UserInfo.getElementsByClassName("Link").item(0).onclick = function(){
|
||||||
|
var AJAX = new XMLHttpRequest();
|
||||||
|
AJAX.open("get","login.html");
|
||||||
|
AJAX.send();
|
||||||
|
AJAX.onreadystatechange = function(ev){
|
||||||
|
document.getElementById("Body").innerHTML = AJAX.response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
var User = JSON.parse(localStorage.getItem("OnlineAIUser"));
|
||||||
|
UserInfo.getElementsByClassName("UserName").item(0).innerHTML = User.ID;
|
||||||
|
UserInfo.getElementsByClassName("Link").item(0).innerHTML = "注销";
|
||||||
|
UserInfo.getElementsByClassName("Link").item(0).onclick = function(){
|
||||||
|
alert(2);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
//
|
||||||
|
</script>
|
||||||
|
<div id="Top"><a id="Title"></a></div>
|
||||||
|
</head>
|
||||||
|
<body id="Body">
|
||||||
|
<div id="UserInfo">
|
||||||
|
<a class="UserName"></a>||<a class="Link"></a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
28
Server/login.html
普通文件
28
Server/login.html
普通文件
@ -0,0 +1,28 @@
|
|||||||
|
<div id="Login">
|
||||||
|
<a>账户:</a><input type="text" class="LoginUserName" /><br>
|
||||||
|
<a>密码:</a><input type="password" class="LoginPassWord" /><br>
|
||||||
|
<button class="LoginButton">登录</button>
|
||||||
|
<a class="LoginInfo" style="color:#FF0000"></a>
|
||||||
|
<script>
|
||||||
|
var Login;
|
||||||
|
window.onload = function(){
|
||||||
|
Login = document.getElementById("Login");
|
||||||
|
Login.getElementsByClassName("LoginButton").item(0).onclick = function(){
|
||||||
|
var LUN = Login.getElementsByClassName("LoginUserName").item(0).nodeValue;
|
||||||
|
var LPW = Login.getElementsByClassName("LoginPassWord").item(0).nodeValue;
|
||||||
|
var AJAX = new XMLHttpRequest();
|
||||||
|
AJAX.open("get",`CGI.php?Do=Login&UserName=${LUN}&PassWord=${LPW}`);
|
||||||
|
AJAX.onreadystatechange = function(){
|
||||||
|
var data = JSON.parse(AJAX.responseText);
|
||||||
|
if(data["Allow"]){
|
||||||
|
var User = {"ID":LUN};
|
||||||
|
localStorage.setItem("User",JSON.stringify(User));
|
||||||
|
window.location.reload();
|
||||||
|
}else{
|
||||||
|
Login.getElementsByClassName("LoginInfo").item(0).innerHtml = "账号或者密码错误,请重新尝试。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
20
[SIGN]
普通文件
20
[SIGN]
普通文件
@ -0,0 +1,20 @@
|
|||||||
|
-----[VERSION 0][CN]-----
|
||||||
|
协议内容:
|
||||||
|
授权电脑网络工作室永久的
|
||||||
|
《OnlineAI Core》使用权,允
|
||||||
|
许电脑网络工作室重新开发、分
|
||||||
|
发、销售此程序。
|
||||||
|
|
||||||
|
授权机构:
|
||||||
|
《OnlineAI》开发部
|
||||||
|
|
||||||
|
|
||||||
|
-----[VERSION 1][CN]-----
|
||||||
|
协议内容:
|
||||||
|
授权《OnlineAI》团队永
|
||||||
|
的《OnlineAI Core》使用
|
||||||
|
权。
|
||||||
|
|
||||||
|
授权机构:
|
||||||
|
<1>电脑网络工作室
|
||||||
|
<2>《OnlineAI》开发部
|
||||||
42
test.js
普通文件
42
test.js
普通文件
@ -0,0 +1,42 @@
|
|||||||
|
//const https = require('http');
|
||||||
|
const request = require('request');
|
||||||
|
const crypto = require('crypto');
|
||||||
|
const md5 = crypto.createHash('md5');
|
||||||
|
|
||||||
|
var params = new Object({
|
||||||
|
app_id:"2125346185",//APPID
|
||||||
|
time_stamp: Date.parse(new Date())/1000,//时间戳
|
||||||
|
"nonce\_str":new String("A"+Math.floor(Math.random() * 100000000)),//随机文本
|
||||||
|
session:"927980270",//测试环境下账号伪造
|
||||||
|
question:"你好呀"//测试环境下内容伪造
|
||||||
|
});
|
||||||
|
console.log(params);
|
||||||
|
var key = "T6zpC15OkWJ9jP0a";//APP Key
|
||||||
|
var p2 = new Object();
|
||||||
|
var k = Object.keys(params).sort();
|
||||||
|
console.log(k)
|
||||||
|
for(var i = 0;i<k.length;i++){
|
||||||
|
p2[k[i]] = params[k[i]];
|
||||||
|
}
|
||||||
|
console.log(p2)
|
||||||
|
var Str="";
|
||||||
|
for(var i = 0;i<k.length;i++){
|
||||||
|
Str=Str+Object.keys(p2)[i]+"="+encodeURI(Object.values(p2)[i])+"&";
|
||||||
|
}
|
||||||
|
|
||||||
|
Str = Str+"app_key="+key;
|
||||||
|
console.log(Str)
|
||||||
|
sign = md5.update(Str).digest("hex").toUpperCase();
|
||||||
|
console.log(sign)
|
||||||
|
params["sign"] = sign;
|
||||||
|
|
||||||
|
request.get({
|
||||||
|
url:`https://api.ai.qq.com/fcgi-bin/nlp/nlp_textchat?${Str}&sign=${sign}`,
|
||||||
|
encoding:'utf8'
|
||||||
|
},(err,req,body)=>{
|
||||||
|
if(req.statusCode==200){
|
||||||
|
console.log(body);
|
||||||
|
var an = JSON.parse(body)["data"]["answer"];
|
||||||
|
console.log(an);
|
||||||
|
}
|
||||||
|
})
|
||||||
204
公会系统.js
普通文件
204
公会系统.js
普通文件
@ -0,0 +1,204 @@
|
|||||||
|
//固定资产
|
||||||
|
const fs=require("fs");
|
||||||
|
const Core = require("./Core");
|
||||||
|
const Money = require("./Money");
|
||||||
|
fs.exists("./Data/公会.json",(ex)=>{
|
||||||
|
if(!ex){
|
||||||
|
fs.writeFile("./Data/公会.json",JSON.stringify({}),(err)=>{
|
||||||
|
console.log(`[${new Date().toString()}][${module.filename}]创建公会档案记录。`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
exports.add={
|
||||||
|
Interfaces:{
|
||||||
|
GetUserPublic:function(UserID){
|
||||||
|
var data = Core.frame.ReadSystemConfig("公会系统");
|
||||||
|
if(data[UserID]==undefined||null||NaN){
|
||||||
|
return "[无工会]";
|
||||||
|
}else{
|
||||||
|
return data[UserID];
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
SetUserPublic:function(UserID,公会){
|
||||||
|
var data = Core.frame.ReadSystemConfig("公会系统");
|
||||||
|
data[UserID] = 公会;
|
||||||
|
Core.frame.WriteSystemConfig("公会系统",data);
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
CreatePublic:function(info,gh){
|
||||||
|
公会 = gh[0]
|
||||||
|
var data = JSON.parse(fs.readFileSync("./Data/公会.json").toString());
|
||||||
|
data[公会]={};
|
||||||
|
data[公会]["Name"] = 公会;
|
||||||
|
data[公会]["Owner"] = Core.GetUser(info["user_id"]);
|
||||||
|
data[公会]["Admin"] = {};
|
||||||
|
data[公会]["Admin"][Core.GetUser(info["user_id"])] = true;
|
||||||
|
data[公会]["Higher"] = gh[1];
|
||||||
|
data[公会]["Info"] = "暂无介绍";
|
||||||
|
if(info["group_id"]!=undefined){
|
||||||
|
data[公会]["CreationByGroup"] = info["group_id"];
|
||||||
|
}else{
|
||||||
|
data[公会]["CreationByGroup"] = "暂无";
|
||||||
|
}
|
||||||
|
data[公会]["Downer"] = [];
|
||||||
|
fs.writeFileSync("./Data/公会.json",JSON.stringify(data));
|
||||||
|
var data2 = Core.frame.ReadSystemConfig("公会系统");
|
||||||
|
data2[Core.GetUser(info["user_id"])] = 公会;
|
||||||
|
Core.frame.WriteSystemConfig("公会系统",data2);
|
||||||
|
},
|
||||||
|
GetPublicInfo:function(公会){
|
||||||
|
if(!exports.add.Interfaces.IsPublic(公会)){return `${false}`;}
|
||||||
|
var data = JSON.parse(fs.readFileSync("./Data/公会.json").toString());
|
||||||
|
var br = "\\r\\n"
|
||||||
|
var info = `公会名称:${data[公会]["Name"]}${br}会长:${data[公会]["Owner"]}${Core.frame.At(data[公会]["Owner"])}${br}介绍:${data[公会]["Info"]}${br}交流群:${data[公会]["CreationByGroup"]}`;
|
||||||
|
return info;
|
||||||
|
},
|
||||||
|
IsPublic:function(公会){
|
||||||
|
var data =JSON.parse(fs.readFileSync("./Data/公会.json").toString());
|
||||||
|
if(data[公会]!=undefined||NaN||null){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SetPublicValue:function(公会,Key,Value){
|
||||||
|
fs.readFile("./Data/公会.json",(err,data)=>{
|
||||||
|
d2 = JSON.parse(data.toString());
|
||||||
|
d2[公会][Key] = Value;
|
||||||
|
fs.writeFile("./Data/公会.json",JSON.stringify(d2),()=>{
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
GetPublicValue:function(公会,Key){
|
||||||
|
console.log(公会);
|
||||||
|
console.log(Key);
|
||||||
|
var data = JSON.parse(fs.readFileSync("./Data/公会.json").toString());
|
||||||
|
console.log(data);
|
||||||
|
return data[公会][Key];
|
||||||
|
},
|
||||||
|
GetuserLeven:function(公会,user){
|
||||||
|
console.log(公会);
|
||||||
|
console.log(user);
|
||||||
|
var data = JSON.parse(fs.readFileSync("./Data/公会.json").toString());
|
||||||
|
console.log(data);
|
||||||
|
if(user == data[公会]["Owner"]){
|
||||||
|
return 3;//公会会长
|
||||||
|
};
|
||||||
|
var od = new Object(data[公会]["Admin"]);
|
||||||
|
for(var i=0;i<Object.keys(od).length;i++){
|
||||||
|
if(user == Object.keys(od)[i]){
|
||||||
|
return 2;//公会管理员
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(exports.add.Interfaces.GetUserPublic(user) == 公会){
|
||||||
|
return 1;//公会成员
|
||||||
|
}
|
||||||
|
return 0;//有啥关?没啥关!!!
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
//console.log("["+new Date().toString()+"][公会系统.js]正在处理");
|
||||||
|
var data = JSON.parse(fs.readFileSync("./UserDataBase.json"));
|
||||||
|
const date = new Date();
|
||||||
|
var msg = new String(info["raw_message"]);
|
||||||
|
if(msg=="领工资"){
|
||||||
|
if(data["领工资"][Core.GetUser(info["user_id"])]==date.getFullYear().toString()+date.getMonth().toString()+date.getDay().toString()){
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"已领过工资了!");
|
||||||
|
}else{
|
||||||
|
Money.add.Interfaces.GiveUserMoney(Core.GetUser(info["user_id"]),500);
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"领工资成功,获得500RMB,当前余额"+Money.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"])));
|
||||||
|
var data = JSON.parse(fs.readFileSync("./UserDataBase.json"));
|
||||||
|
data["领工资"][Core.GetUser(info["user_id"])]=date.getFullYear().toString()+date.getMonth().toString()+date.getDay().toString();
|
||||||
|
fs.writeFileSync("./UserDataBase.json",JSON.stringify(data));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
if(msg.substr(0,4)=="创建公会"){
|
||||||
|
if(Money.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"]))<5000){
|
||||||
|
Core.frame.SendMsg(connect,info,"您的余额不足5000,无法创建公会!");
|
||||||
|
}else{
|
||||||
|
if(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"]))!="[无工会]"){
|
||||||
|
Core.frame.SendMsg(connect,info,"您已经加入了一个公会!");
|
||||||
|
}else{
|
||||||
|
var n = msg.replace("创建公会","");
|
||||||
|
n2 = n.split("+");
|
||||||
|
if(n.length==0){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入公会名称");
|
||||||
|
}else{
|
||||||
|
if(exports.add.Interfaces.IsPublic(n)){
|
||||||
|
Core.frame.SendMsg(connect,info,"此公会已存在,请输入别的公会名称");
|
||||||
|
}else{
|
||||||
|
exports.add.Interfaces.CreatePublic(info,n2);
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+",创建公会成功!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(msg=="公会列表"){
|
||||||
|
var data = JSON.parse(fs.readFileSync("./Data/公会.json").toString());
|
||||||
|
var o = Object.keys(data);
|
||||||
|
var f="公会列表如下:";
|
||||||
|
for(var i=0;i<o.length;i++){
|
||||||
|
f = f +"\\r\\n" + (i+1) + "." + o[i]
|
||||||
|
}
|
||||||
|
Core.frame.SendMsg(connect,info,f);
|
||||||
|
};
|
||||||
|
if(msg.substr(0,4)=="加入公会"){
|
||||||
|
if(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"]))!="[无工会]"){
|
||||||
|
Core.frame.SendMsg(connect,info,"您已经加入了一个公会!");
|
||||||
|
}else{
|
||||||
|
var n = msg.replace("加入公会","");
|
||||||
|
if(n.length==0){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入公会名称");
|
||||||
|
}else{
|
||||||
|
exports.add.Interfaces.SetUserPublic(Core.GetUser(info["user_id"]),n);
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+",加入公会成功!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(msg=="查看我的公会"){
|
||||||
|
console.log(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"])));
|
||||||
|
Core.frame.SendMsg(connect,info,exports.add.Interfaces.GetPublicInfo(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"]))));
|
||||||
|
};
|
||||||
|
if(msg=="退出公会"){
|
||||||
|
exports.add.Interfaces.SetUserPublic(Core.GetUser(info["user_id"]),"[无工会]");
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+",退出公会成功!");
|
||||||
|
};
|
||||||
|
if(msg.substr(0,4)=="查看公会"){
|
||||||
|
var n = msg.replace("查看公会","");
|
||||||
|
if(n.length==0){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入公会名称");
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,exports.add.Interfaces.GetPublicInfo(n));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(msg.substr(0,6)=="设置公会简介"){
|
||||||
|
var n = msg.replace("设置公会简介","");
|
||||||
|
if(n.length==0){
|
||||||
|
Core.frame.SendMsg(connect,info,"请输入简介内容");
|
||||||
|
}else{
|
||||||
|
if(exports.add.Interfaces.GetuserLeven(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"])))>=2){
|
||||||
|
Core.frame.SendMsg(connect,info,"你不是公会管理员");
|
||||||
|
}
|
||||||
|
exports.add.Interfaces.SetPublicValue(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"])),"Info",n);
|
||||||
|
Core.frame.SendMsg(connect,info,"设置完毕");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(msg.substr(0,6)=="设置公会管理"){
|
||||||
|
var n = msg.replace("设置公会管理","");
|
||||||
|
n = n.replace("[CQ:At,qq=","");
|
||||||
|
n = n.replace("]","");
|
||||||
|
n = n.replace(" ","");
|
||||||
|
if(exports.add.Interfaces.GetuserLeven(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"])),Core.GetUser(info["user_id"])) == 3){
|
||||||
|
var data = exports.add.Interfaces.GetPublicValue(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"])),"Admin");
|
||||||
|
data[n] = true;
|
||||||
|
exports.add.Interfaces.SetPublicValue(exports.add.Interfaces.GetUserPublic(Core.GetUser(info["user_id"])),"Admin",data);
|
||||||
|
Core.frame.SendMsg(connect,info,"设置完毕");
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,"必须公会会长才可以设置管理员");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
抢劫.js
普通文件
33
抢劫.js
普通文件
@ -0,0 +1,33 @@
|
|||||||
|
//固定资产
|
||||||
|
const fs=require("fs");
|
||||||
|
const Core = require("./Core");
|
||||||
|
const MoneyInterfaces = require("./Money").add.Interfaces;
|
||||||
|
exports.add={
|
||||||
|
Interfaces:{},
|
||||||
|
Control:function(connect,info){
|
||||||
|
//console.log("["+new Date().toString()+"][抢劫.js]正在处理");
|
||||||
|
var Temp1 = new String(info["raw_message"]);
|
||||||
|
if(Temp1.substr(0,2)=="抢劫"){
|
||||||
|
if(Temp1.length == 2){
|
||||||
|
Core.frame.SendMsg(connect,info,"此命令的格式是:抢劫@XX(XX为要被抢劫的人)")
|
||||||
|
}else{
|
||||||
|
var UQQ = Temp1.replace('[CQ:at,qq=',"");
|
||||||
|
UQQ = UQQ.replace(']',"");
|
||||||
|
UQQ = UQQ.replace('抢劫',"");
|
||||||
|
UQQ = UQQ.replace(' ',"");
|
||||||
|
if(MoneyInterfaces.GetUserMoney(UQQ)<500){
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(UQQ)+"的余额不足500,不可抢劫。");
|
||||||
|
}else{
|
||||||
|
var Temp2 = Math.ceil(Math.random() * 500);
|
||||||
|
if(UQQ == Core.GetUser(info["user_id"])){
|
||||||
|
Temp2 = 0;
|
||||||
|
}
|
||||||
|
MoneyInterfaces.GiveUserMoney(Core.GetUser(info["user_id"]),Temp2);
|
||||||
|
MoneyInterfaces.CostUserMoney(UQQ,Temp2);
|
||||||
|
Core.frame.SendMsg(connect,info,Core.frame.At(Core.GetUser(info["user_id"]))+"抢劫成功!你抢到"+Temp2+"元,你的余额"+MoneyInterfaces.GetUserMoney(Core.GetUser(info["user_id"]))+"元");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//console.log("["+new Date().toString()+"][抢劫.js]处理完成");
|
||||||
|
}
|
||||||
|
}
|
||||||
59
板砖.js
普通文件
59
板砖.js
普通文件
@ -0,0 +1,59 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const Core = require("./Core");
|
||||||
|
const Money = require("./Money");
|
||||||
|
const Debug = require("./Debug");
|
||||||
|
exports.add = {
|
||||||
|
Interfaces:{
|
||||||
|
GetUser板砖:function(user_id){
|
||||||
|
var data_obj = Core.frame.ReadSystemConfig("板砖");
|
||||||
|
return data_obj[user_id];
|
||||||
|
},
|
||||||
|
GiveUser板砖:function(user_id,count){
|
||||||
|
var data_obj = Core.frame.ReadSystemConfig("板砖");
|
||||||
|
data_obj[user_id] = this.GetUser板砖(user_id) + count;
|
||||||
|
Core.frame.WriteSystemConfig("板砖",data_obj);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Control:function(connect,info){
|
||||||
|
var message = new String(info["message"]);
|
||||||
|
console.log("a");
|
||||||
|
console.log(message);
|
||||||
|
if(message=="购买板砖"){
|
||||||
|
console.log("b");
|
||||||
|
if(Money.add.Interfaces.GetUserMoney(Core.GetUser(info["user_id"]))>100){
|
||||||
|
Money.add.Interfaces.CostUserMoney(Core.GetUser(info["user_id"]),100);
|
||||||
|
exports.add.Interfaces.GiveUser板砖(Core.GetUser(info["user_id"]),1);
|
||||||
|
Core.frame.SendMsg(connect,info,`<获得板砖>\\r\\n[板砖]*1\\r\\n<持有板砖>\\r\\n[板砖]*${exports.add.Interfaces.GetUser板砖(Core.GetUser(info["user_id"]))}`);
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,"你的金币不足100。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(message.substr(0,3)=="敲板砖"){
|
||||||
|
var Tuser = message.replace("敲板砖","");
|
||||||
|
Tuser = Tuser.replace("[CQ:at,qq=","");
|
||||||
|
Tuser = Tuser.replace("]","");
|
||||||
|
Tuser = Tuser.replace(" ","");
|
||||||
|
if(Tuser == Core.GetUser(info["user_id"])){
|
||||||
|
Core.frame.SendMsg(connect,info,"不可以敲自己");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!exports.add.Interfaces.GetUser板砖(Core.GetUser(info["user_id"]))>=1){
|
||||||
|
Core.frame.SendMsg(connect,info,"你没有板砖,快去购买一个吧!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(Debug.add.Interfaces.IsAdmin(Core.GetUser(Tuser))){
|
||||||
|
if(Debug.add.Interfaces.IsAdmin(Core.GetUser(info["user_id"]))){
|
||||||
|
Core.frame.SendMsg(connect,info,`${Core.frame.At(Core.GetUser(info["user_id"]))},你们AI管理员别内斗了行不!?`);
|
||||||
|
}else{
|
||||||
|
Core.frame.SendMsg(connect,info,"AI管理员不可以被板砖攻击。");
|
||||||
|
Core.frame.Ban(connect,info,60);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var BT = Math.floor(Math.random()*300);
|
||||||
|
exports.add.Interfaces.GiveUser板砖(Core.GetUser(info["user_id"]),-1);
|
||||||
|
Core.frame._Ban(connect,info,Tuser,BT);
|
||||||
|
Core.frame.SendMsg(connect,info,`敲板砖成功,已禁言${Core.frame.At(Tuser)}长达${BT}秒。你剩余${exports.add.Interfaces.GetUser板砖(Core.GetUser(info["user_id"]))}个板砖。`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
231
狗屁不通文章生成器.js
普通文件
231
狗屁不通文章生成器.js
普通文件
@ -0,0 +1,231 @@
|
|||||||
|
const Core = require("./Core");
|
||||||
|
var set = {
|
||||||
|
主题:"测试",
|
||||||
|
字数:100
|
||||||
|
}
|
||||||
|
let 论述 = [
|
||||||
|
"现在,解决set.主题的问题,是非常非常重要的。 所以, ",
|
||||||
|
"我们不得不面对一个非常尴尬的事实,那就是, ",
|
||||||
|
"set.主题的发生,到底需要如何做到,不set.主题的发生,又会如何产生。 ",
|
||||||
|
"而这些并不是完全重要,更加重要的问题是, ",
|
||||||
|
"set.主题,到底应该如何实现。 ",
|
||||||
|
"带着这些问题,我们来审视一下set.主题。 ",
|
||||||
|
"所谓set.主题,关键是set.主题需要如何写。 ",
|
||||||
|
"我们一般认为,抓住了问题的关键,其他一切则会迎刃而解。 ",
|
||||||
|
"问题的关键究竟为何? ",
|
||||||
|
"set.主题因何而发生?",
|
||||||
|
"每个人都不得不面对这些问题。 在面对这种问题时, ",
|
||||||
|
"一般来讲,我们都必须务必慎重的考虑考虑。 ",
|
||||||
|
"要想清楚,set.主题,到底是一种怎么样的存在。 ",
|
||||||
|
"了解清楚set.主题到底是一种怎么样的存在,是解决一切问题的关键。 ",
|
||||||
|
"就我个人来说,set.主题对我的意义,不能不说非常重大。 ",
|
||||||
|
"本人也是经过了深思熟虑,在每个日日夜夜思考这个问题。 ",
|
||||||
|
"set.主题,发生了会如何,不发生又会如何。 ",
|
||||||
|
"在这种困难的抉择下,本人思来想去,寝食难安。 ",
|
||||||
|
"生活中,若set.主题出现了,我们就不得不考虑它出现了的事实。 ",
|
||||||
|
"这种事实对本人来说意义重大,相信对这个世界也是有一定意义的。 ",
|
||||||
|
"我们都知道,只要有意义,那么就必须慎重考虑。 ",
|
||||||
|
"既然如此, ",
|
||||||
|
"那么, ",
|
||||||
|
"我认为, ",
|
||||||
|
"一般来说, ",
|
||||||
|
"总结的来说, ",
|
||||||
|
"既然如何, ",
|
||||||
|
"经过上述讨论",
|
||||||
|
]
|
||||||
|
|
||||||
|
let 名人名言 = [
|
||||||
|
"伏尔泰曾经说过,不经巨大的困难,不会有伟大的事业。这不禁令我深思",
|
||||||
|
"富勒曾经说过,苦难磨炼一些人,也毁灭另一些人。这不禁令我深思",
|
||||||
|
"文森特·皮尔曾经说过,改变你的想法,你就改变了自己的世界。这不禁令我深思",
|
||||||
|
"拿破仑·希尔曾经说过,不要等待,时机永远不会恰到好处。这不禁令我深思",
|
||||||
|
"塞涅卡曾经说过,生命如同寓言,其价值不在与长短,而在与内容。这不禁令我深思",
|
||||||
|
"奥普拉·温弗瑞曾经说过,你相信什么,你就成为什么样的人。这不禁令我深思",
|
||||||
|
"吕凯特曾经说过,生命不可能有两次,但许多人连一次也不善于度过。这不禁令我深思",
|
||||||
|
"莎士比亚曾经说过,人的一生是短的,但如果卑劣地过这一生,就太长了。这不禁令我深思",
|
||||||
|
"笛卡儿曾经说过,我的努力求学没有得到别的好处,只不过是愈来愈发觉自己的无知。这不禁令我深思",
|
||||||
|
"左拉曾经说过,生活的道路一旦选定,就要勇敢地走到底,决不回头。这不禁令我深思",
|
||||||
|
"米歇潘曾经说过,生命是一条艰险的峡谷,只有勇敢的人才能通过。这不禁令我深思",
|
||||||
|
"吉姆·罗恩曾经说过,要么你主宰生活,要么你被生活主宰。这不禁令我深思",
|
||||||
|
"日本谚语曾经说过,不幸可能成为通向幸福的桥梁。这不禁令我深思",
|
||||||
|
"海贝尔曾经说过,人生就是学校。在那里,与其说好的教师是幸福,不如说好的教师是不幸。这不禁令我深思",
|
||||||
|
"杰纳勒尔·乔治·S·巴顿曾经说过,接受挑战,就可以享受胜利的喜悦。这不禁令我深思",
|
||||||
|
"德谟克利特曾经说过,节制使快乐增加并使享受加强。这不禁令我深思",
|
||||||
|
"裴斯泰洛齐曾经说过,今天应做的事没有做,明天再早也是耽误了。这不禁令我深思",
|
||||||
|
"歌德曾经说过,决定一个人的一生,以及整个命运的,只是一瞬之间。这不禁令我深思",
|
||||||
|
"卡耐基曾经说过,一个不注意小事情的人,永远不会成就大事业。这不禁令我深思",
|
||||||
|
"卢梭曾经说过,浪费时间是一桩大罪过。这不禁令我深思",
|
||||||
|
"康德曾经说过,既然我已经踏上这条道路,那么,任何东西都不应妨碍我沿着这条路走下去。这不禁令我深思",
|
||||||
|
"克劳斯·莫瑟爵士曾经说过,教育需要花费钱,而无知也是一样。这不禁令我深思",
|
||||||
|
"伏尔泰曾经说过,坚持意志伟大的事业需要始终不渝的精神。这不禁令我深思",
|
||||||
|
"亚伯拉罕·林肯曾经说过,你活了多少岁不算什么,重要的是你是如何度过这些岁月的。这不禁令我深思",
|
||||||
|
"韩非曾经说过,内外相应,言行相称。这不禁令我深思",
|
||||||
|
"富兰克林曾经说过,你热爱生命吗?那么别浪费时间,因为时间是组成生命的材料。这不禁令我深思",
|
||||||
|
"马尔顿曾经说过,坚强的信心,能使平凡的人做出惊人的事业。这不禁令我深思",
|
||||||
|
"笛卡儿曾经说过,读一切好书,就是和许多高尚的人谈话。这不禁令我深思",
|
||||||
|
"塞涅卡曾经说过,真正的人生,只有在经过艰难卓绝的斗争之后才能实现。这不禁令我深思",
|
||||||
|
"易卜生曾经说过,伟大的事业,需要决心,能力,组织和责任感。这不禁令我深思",
|
||||||
|
"歌德曾经说过,没有人事先了解自己到底有多大的力量,直到他试过以后才知道。这不禁令我深思",
|
||||||
|
"达尔文曾经说过,敢于浪费哪怕一个钟头时间的人,说明他还不懂得珍惜生命的全部价值。这不禁令我深思",
|
||||||
|
"佚名曾经说过,感激每一个新的挑战,因为它会锻造你的意志和品格。这不禁令我深思",
|
||||||
|
"奥斯特洛夫斯基曾经说过,共同的事业,共同的斗争,可以使人们产生忍受一切的力量。 这不禁令我深思",
|
||||||
|
"苏轼曾经说过,古之立大事者,不惟有超世之才,亦必有坚忍不拔之志。这不禁令我深思",
|
||||||
|
"王阳明曾经说过,故立志者,为学之心也;为学者,立志之事也。这不禁令我深思",
|
||||||
|
"歌德曾经说过,读一本好书,就如同和一个高尚的人在交谈。这不禁令我深思",
|
||||||
|
"乌申斯基曾经说过,学习是劳动,是充满思想的劳动。这不禁令我深思",
|
||||||
|
"别林斯基曾经说过,好的书籍是最贵重的珍宝。这不禁令我深思",
|
||||||
|
"富兰克林曾经说过,读书是易事,思索是难事,但两者缺一,便全无用处。这不禁令我深思",
|
||||||
|
"鲁巴金曾经说过,读书是在别人思想的帮助下,建立起自己的思想。这不禁令我深思",
|
||||||
|
"培根曾经说过,合理安排时间,就等于节约时间。这不禁令我深思",
|
||||||
|
"屠格涅夫曾经说过,你想成为幸福的人吗?但愿你首先学会吃得起苦。这不禁令我深思",
|
||||||
|
"莎士比亚曾经说过,抛弃时间的人,时间也抛弃他。这不禁令我深思",
|
||||||
|
"叔本华曾经说过,普通人只想到如何度过时间,有才能的人设法利用时间。这不禁令我深思",
|
||||||
|
"博曾经说过,一次失败,只是证明我们成功的决心还够坚强。 维这不禁令我深思",
|
||||||
|
"拉罗什夫科曾经说过,取得成就时坚持不懈,要比遭到失败时顽强不屈更重要。这不禁令我深思",
|
||||||
|
"莎士比亚曾经说过,人的一生是短的,但如果卑劣地过这一生,就太长了。这不禁令我深思",
|
||||||
|
"俾斯麦曾经说过,失败是坚忍的最后考验。这不禁令我深思",
|
||||||
|
"池田大作曾经说过,不要回避苦恼和困难,挺起身来向它挑战,进而克服它。这不禁令我深思",
|
||||||
|
"莎士比亚曾经说过,那脑袋里的智慧,就像打火石里的火花一样,不去打它是不肯出来的。这不禁令我深思",
|
||||||
|
"希腊曾经说过,最困难的事情就是认识自己。这不禁令我深思",
|
||||||
|
"黑塞曾经说过,有勇气承担命运这才是英雄好汉。这不禁令我深思",
|
||||||
|
"非洲曾经说过,最灵繁的人也看不见自己的背脊。这不禁令我深思",
|
||||||
|
"培根曾经说过,阅读使人充实,会谈使人敏捷,写作使人精确。这不禁令我深思",
|
||||||
|
"斯宾诺莎曾经说过,最大的骄傲于最大的自卑都表示心灵的最软弱无力。这不禁令我深思",
|
||||||
|
"西班牙曾经说过,自知之明是最难得的知识。这不禁令我深思",
|
||||||
|
"塞内加曾经说过,勇气通往天堂,怯懦通往地狱。这不禁令我深思",
|
||||||
|
"赫尔普斯曾经说过,有时候读书是一种巧妙地避开思考的方法。这不禁令我深思",
|
||||||
|
"笛卡儿曾经说过,阅读一切好书如同和过去最杰出的人谈话。这不禁令我深思",
|
||||||
|
"邓拓曾经说过,越是没有本领的就越加自命不凡。这不禁令我深思",
|
||||||
|
"爱尔兰曾经说过,越是无能的人,越喜欢挑剔别人的错儿。这不禁令我深思",
|
||||||
|
"老子曾经说过,知人者智,自知者明。胜人者有力,自胜者强。这不禁令我深思",
|
||||||
|
"歌德曾经说过,意志坚强的人能把世界放在手中像泥块一样任意揉捏。这不禁令我深思",
|
||||||
|
"迈克尔·F·斯特利曾经说过,最具挑战性的挑战莫过于提升自我。这不禁令我深思",
|
||||||
|
"爱迪生曾经说过,失败也是我需要的,它和成功对我一样有价值。这不禁令我深思",
|
||||||
|
"罗素·贝克曾经说过,一个人即使已登上顶峰,也仍要自强不息。这不禁令我深思",
|
||||||
|
"马云曾经说过,最大的挑战和突破在于用人,而用人最大的突破在于信任人。这不禁令我深思",
|
||||||
|
"雷锋曾经说过,自己活着,就是为了使别人过得更美好。这不禁令我深思",
|
||||||
|
"布尔沃曾经说过,要掌握书,莫被书掌握;要为生而读,莫为读而生。这不禁令我深思",
|
||||||
|
"培根曾经说过,要知道对好事的称颂过于夸大,也会招来人们的反感轻蔑和嫉妒。这不禁令我深思",
|
||||||
|
"莫扎特曾经说过,谁和我一样用功,谁就会和我一样成功。这不禁令我深思",
|
||||||
|
"马克思曾经说过,一切节省,归根到底都归结为时间的节省。这不禁令我深思",
|
||||||
|
"莎士比亚曾经说过,意志命运往往背道而驰,决心到最后会全部推倒。这不禁令我深思",
|
||||||
|
"卡莱尔曾经说过,过去一切时代的精华尽在书中。这不禁令我深思",
|
||||||
|
"培根曾经说过,深窥自己的心,而后发觉一切的奇迹在你自己。这不禁令我深思",
|
||||||
|
"罗曼·罗兰曾经说过,只有把抱怨环境的心情,化为上进的力量,才是成功的保证。这不禁令我深思",
|
||||||
|
"孔子曾经说过,知之者不如好之者,好之者不如乐之者。这不禁令我深思",
|
||||||
|
"达·芬奇曾经说过,大胆和坚定的决心能够抵得上武器的精良。这不禁令我深思",
|
||||||
|
"叔本华曾经说过,意志是一个强壮的盲人,倚靠在明眼的跛子肩上。这不禁令我深思",
|
||||||
|
"黑格尔曾经说过,只有永远躺在泥坑里的人,才不会再掉进坑里。这不禁令我深思",
|
||||||
|
"普列姆昌德曾经说过,希望的灯一旦熄灭,生活刹那间变成了一片黑暗。这不禁令我深思",
|
||||||
|
"维龙曾经说过,要成功不需要什么特别的才能,只要把你能做的小事做得好就行了。这不禁令我深思",
|
||||||
|
"郭沫若曾经说过,形成天才的决定因素应该是勤奋。这不禁令我深思",
|
||||||
|
"洛克曾经说过,学到很多东西的诀窍,就是一下子不要学很多。这不禁令我深思",
|
||||||
|
"西班牙曾经说过,自己的鞋子,自己知道紧在哪里。这不禁令我深思",
|
||||||
|
"拉罗什福科曾经说过,我们唯一不会改正的缺点是软弱。这不禁令我深思",
|
||||||
|
"亚伯拉罕·林肯曾经说过,我这个人走得很慢,但是我从不后退。这不禁令我深思",
|
||||||
|
"美华纳曾经说过,勿问成功的秘诀为何,且尽全力做你应该做的事吧。这不禁令我深思",
|
||||||
|
"俾斯麦曾经说过,对于不屈不挠的人来说,没有失败这回事。这不禁令我深思",
|
||||||
|
"阿卜·日·法拉兹曾经说过,学问是异常珍贵的东西,从任何源泉吸收都不可耻。这不禁令我深思",
|
||||||
|
"白哲特曾经说过,坚强的信念能赢得强者的心,并使他们变得更坚强。 这不禁令我深思",
|
||||||
|
"查尔斯·史考伯曾经说过,一个人几乎可以在任何他怀有无限热忱的事情上成功。 这不禁令我深思",
|
||||||
|
"贝多芬曾经说过,卓越的人一大优点是:在不利与艰难的遭遇里百折不饶。这不禁令我深思",
|
||||||
|
"莎士比亚曾经说过,本来无望的事,大胆尝试,往往能成功。这不禁令我深思",
|
||||||
|
"卡耐基曾经说过,我们若已接受最坏的,就再没有什么损失。这不禁令我深思",
|
||||||
|
"德国曾经说过,只有在人群中间,才能认识自己。这不禁令我深思",
|
||||||
|
"史美尔斯曾经说过,书籍把我们引入最美好的社会,使我们认识各个时代的伟大智者。这不禁令我深思",
|
||||||
|
"冯学峰曾经说过,当一个人用工作去迎接光明,光明很快就会来照耀着他。这不禁令我深思",
|
||||||
|
"吉格·金克拉曾经说过,如果你能做梦,你就能实现它。这不禁令我深思",
|
||||||
|
"蓝树叶曾经说过,OnlineAI Core的更新是必然的,这不禁令我深思",
|
||||||
|
]
|
||||||
|
|
||||||
|
let 后面垫话 = [
|
||||||
|
"这不禁令我深思。 ",
|
||||||
|
"带着这句话,我们还要更加慎重的审视这个问题: ",
|
||||||
|
"这启发了我, ",
|
||||||
|
"我希望诸位也能好好地体会这句话。 ",
|
||||||
|
"这句话语虽然很短,但令我浮想联翩。 ",
|
||||||
|
]
|
||||||
|
|
||||||
|
let 前面垫话 = [
|
||||||
|
"曾经说过",
|
||||||
|
"在不经意间这样说过",
|
||||||
|
]
|
||||||
|
|
||||||
|
function 随便取一句(列表){
|
||||||
|
let 坐标 = Math.floor( Math.random() * 列表.length );
|
||||||
|
return 列表[坐标];
|
||||||
|
}
|
||||||
|
|
||||||
|
function 随便取一个数(最小值 = 0,最大值 = 100){
|
||||||
|
let 数字 = Math.random()*( 最大值 - 最小值 ) + 最小值;
|
||||||
|
return 数字;
|
||||||
|
}
|
||||||
|
|
||||||
|
function 来点名人名言(){
|
||||||
|
let 名言 = 随便取一句(名人名言)
|
||||||
|
名言 = 名言.replace("曾经说过", 随便取一句(前面垫话) )
|
||||||
|
名言 = 名言.replace("这不禁令我深思", 随便取一句(后面垫话) )
|
||||||
|
return 名言
|
||||||
|
}
|
||||||
|
|
||||||
|
function 来点论述(){
|
||||||
|
let 句子 = 随便取一句(论述);
|
||||||
|
句子 = 句子.replace(RegExp("set.主题", "g"),set.主题);
|
||||||
|
return 句子;
|
||||||
|
}
|
||||||
|
|
||||||
|
function 增加段落(章节){
|
||||||
|
if(章节[章节.length-1] === " "){
|
||||||
|
章节 = 章节.slice(0,-2)
|
||||||
|
}
|
||||||
|
return " " + 章节 + "。 "
|
||||||
|
}
|
||||||
|
|
||||||
|
function 生成文章(){
|
||||||
|
let 文章 = []
|
||||||
|
for(let 空 in set.主题){
|
||||||
|
let 章节 = "";
|
||||||
|
let 章节长度 = 0;
|
||||||
|
while( 章节长度 < set.字数 ){
|
||||||
|
let 随机数 = 随便取一个数();
|
||||||
|
if(随机数 < 5 && 章节.length > 200){
|
||||||
|
章节 = 增加段落(章节);
|
||||||
|
文章.push(章节);
|
||||||
|
章节 = "";
|
||||||
|
}else if(随机数 < 20){
|
||||||
|
let 句子 = 来点名人名言();
|
||||||
|
章节长度 = 章节长度 + 句子.length;
|
||||||
|
章节 = 章节 + 句子;
|
||||||
|
}else{
|
||||||
|
let 句子 = 来点论述();
|
||||||
|
章节长度 = 章节长度 + 句子.length;
|
||||||
|
章节 = 章节 + 句子;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
章节 = 增加段落(章节);
|
||||||
|
文章.push(章节);
|
||||||
|
}
|
||||||
|
return 文章.join("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.add = {
|
||||||
|
Interfaces:{},
|
||||||
|
Control:function(connect,info){
|
||||||
|
var ee = new String(info["message"]);
|
||||||
|
if(ee.substr(0,4)=="生成文章"){
|
||||||
|
ee = ee.replace("生成文章","");
|
||||||
|
if(ee.indexOf("||")!=-1){
|
||||||
|
var temp2 = ee.split("||");
|
||||||
|
set.主题 = temp2[0];
|
||||||
|
set.字数 = temp2[1];
|
||||||
|
}else{
|
||||||
|
set.主题 = ee;
|
||||||
|
}
|
||||||
|
var temp = 生成文章()
|
||||||
|
while(temp.indexOf("\n")!=-1){
|
||||||
|
temp = temp.replace("\n","\\n")
|
||||||
|
}
|
||||||
|
Core.frame.SendMsg(connect,info,temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
在新工单中引用
屏蔽一个用户