feat(QQBot): 更新版本并优化消息发送功能
- 将版本号从 v.1.7.7 升级到 v.1.7.8 -重构 sendMessage 方法,支持发送包含图片和回复的消息 - 更新服务器版本查询 URL 为 HTTPS - 注释掉版本查询时的服务器消息发送
This commit is contained in:
parent
607c05e028
commit
237c9273ca
@ -10,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class QQBotApplication {
|
public class QQBotApplication {
|
||||||
public static final String version = "QQBot v.1.7.7";
|
public static final String version = "QQBot v.1.7.8";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("version = " + version);
|
System.out.println("version = " + version);
|
||||||
|
@ -3,10 +3,7 @@ package com.yutou.qqbot;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.yutou.napcat.QQDatabase;
|
import com.yutou.napcat.QQDatabase;
|
||||||
import com.yutou.napcat.handle.BaseHandle;
|
import com.yutou.napcat.handle.*;
|
||||||
import com.yutou.napcat.handle.MessageHandleBuild;
|
|
||||||
import com.yutou.napcat.handle.Reply;
|
|
||||||
import com.yutou.napcat.handle.Text;
|
|
||||||
import com.yutou.napcat.http.NapCatApi;
|
import com.yutou.napcat.http.NapCatApi;
|
||||||
import com.yutou.napcat.model.FriendBean;
|
import com.yutou.napcat.model.FriendBean;
|
||||||
import com.yutou.napcat.model.GroupBean;
|
import com.yutou.napcat.model.GroupBean;
|
||||||
@ -22,6 +19,7 @@ import retrofit2.Response;
|
|||||||
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -166,7 +164,7 @@ public class QQBotManager {
|
|||||||
|
|
||||||
public String sendMessage(String text) {
|
public String sendMessage(String text) {
|
||||||
|
|
||||||
return getNotLoginQQ();
|
return sendMessage(false,defGroup,text).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SendMessageResponse sendMessage(Long group, String text) {
|
public SendMessageResponse sendMessage(Long group, String text) {
|
||||||
@ -186,10 +184,27 @@ public class QQBotManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(File imageFile, Long qq, String replyMessageId, String text) {
|
public void sendMessage(File imageFile, Long qq, String replyMessageId, String text) {
|
||||||
|
List<BaseHandle<?>> items = new ArrayList<>();
|
||||||
|
|
||||||
|
if (imageFile != null) {
|
||||||
|
items.add(new Image(imageFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (replyMessageId != null && !replyMessageId.isEmpty()) {
|
||||||
|
items.add(new Reply(Long.parseLong(replyMessageId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text != null && !text.isEmpty()) {
|
||||||
|
items.add(new Text(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!items.isEmpty()) {
|
||||||
|
sendMessage(QQDatabase.checkFriend(qq),qq, items);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(File imageFile, String text) {
|
public void sendMessage(File imageFile, String text) {
|
||||||
|
sendMessage(true,defQQ,new Image(imageFile),new Text(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendMessage(List<File> imgs, Long qq, String text) {
|
public void sendMessage(List<File> imgs, Long qq, String text) {
|
||||||
@ -248,10 +263,10 @@ public class QQBotManager {
|
|||||||
|
|
||||||
public void sendVersion() {
|
public void sendVersion() {
|
||||||
String localVersion = QQBotApplication.version;
|
String localVersion = QQBotApplication.version;
|
||||||
String serverVersion = HttpTools.get("http://tools.yutou233.cn:8000/public/version.do?token=zIrsh9TUZP2lfRW753PannG49E7VJvor");
|
String serverVersion = HttpTools.get("https://tools.yutou233.cn/public/version.do?token=zIrsh9TUZP2lfRW753PannG49E7VJvor");
|
||||||
String msg = "本地版本:" + localVersion + "\n" + "服务器版本:" + serverVersion;
|
String msg = "本地版本:" + localVersion + "\n" + "服务器版本:" + serverVersion;
|
||||||
QQBotManager.getInstance().sendMessage(msg);
|
QQBotManager.getInstance().sendMessage(msg);
|
||||||
AppTools.sendServer("服务版本查询", msg);
|
// AppTools.sendServer("服务版本查询", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLogin() {
|
public boolean isLogin() {
|
||||||
|
Loading…
Reference in New Issue
Block a user