调整QQ对外接口
This commit is contained in:
@@ -2,6 +2,7 @@ package com.yutou.qqbot.Controllers;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.napcat.QQDatabase;
|
||||
import com.yutou.napcat.handle.At;
|
||||
import com.yutou.napcat.handle.BaseHandle;
|
||||
import com.yutou.napcat.handle.Image;
|
||||
import com.yutou.napcat.handle.Text;
|
||||
@@ -22,6 +23,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
public class AppController {
|
||||
@@ -71,10 +74,14 @@ public class AppController {
|
||||
if (json.getString("message").isEmpty()) {
|
||||
return "not message";
|
||||
}
|
||||
List<BaseHandle<?>> list=new ArrayList<>();
|
||||
list.add(new Text(json.getString("message")));
|
||||
if(json.getString("image")!=null&&!json.getString("image").isEmpty()){
|
||||
list.add(new Image(json.getString("image")));
|
||||
}
|
||||
SendMessageResponse sent = QQBotManager.getInstance().sendMessage(QQDatabase.checkFriend(json.getLong("qq")),
|
||||
json.getLong("qq"),
|
||||
new Text(json.getString("message")),
|
||||
new Image(json.getString("image"))
|
||||
list
|
||||
);
|
||||
return sent == null ? "0" : sent.getId() + "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user