mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
commit
5b4001e411
@ -4,6 +4,7 @@ const express = require("express");
|
||||
const bodyParser = require('body-parser');
|
||||
import {OnebotGroupMemberRole, PostDataAction, PostDataSendMsg} from "../common/types";
|
||||
import {friends, groups, selfInfo} from "./data";
|
||||
import judgeMessage from "./utils";
|
||||
|
||||
function handlePost(jsonData: any) {
|
||||
if (!jsonData.params) {
|
||||
@ -25,7 +26,18 @@ function handlePost(jsonData: any) {
|
||||
else {
|
||||
jsonData.message_type = "group"
|
||||
}
|
||||
sendIPCSendQQMsg(jsonData);
|
||||
// @SiberianHuskY 2021-10-20 22:00:00
|
||||
resData.status=judgeMessage(jsonData.message)||0;
|
||||
if(resData.status==200){
|
||||
resData.message="发送成功";
|
||||
resData.data=jsonData.message;
|
||||
sendIPCSendQQMsg(jsonData);
|
||||
}
|
||||
else{
|
||||
resData.message="发送失败";
|
||||
resData.data=jsonData.message;
|
||||
}
|
||||
// == end ==
|
||||
} else if (jsonData.action == "get_group_list") {
|
||||
resData["data"] = groups.map(group => {
|
||||
return {
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { text } from "express";
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
export function log(msg: any) {
|
||||
@ -5,4 +7,39 @@ export function log(msg: any) {
|
||||
fs.appendFile("./llonebot.log", currentDateTime + ":" + msg + "\n", (err: any) => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// @SiberianHusky 2021-08-15
|
||||
export default function judgeMessage(msg) {
|
||||
if(msg[0]!=null&&msg[0]["type"]!=null&&msg[0]["data"]!=null){
|
||||
let type = msg[0]["type"];
|
||||
let data = msg[0]["data"];
|
||||
if(type == "text"){
|
||||
if (data["text"]!=""&&data["text"]!=null){
|
||||
return 200;
|
||||
}
|
||||
else if(type==="image"){
|
||||
if(data["file"]!=""&&data["file"]!=null){
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
else if(type==="voice"){
|
||||
if(data["file"]!=""&&data["file"]!=null){
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
else if(type==="at"){
|
||||
if(data["qq"]!=""&&data["qq"]!=null){
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
else if(type==="reply"){
|
||||
if(data["id"]!=""&&data["id"]!=null){
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 400;
|
||||
}
|
||||
}
|
||||
// ==end==
|
Loading…
x
Reference in New Issue
Block a user