refactor: 优化代码并更新版本号

- 注释掉 GPT 消息列表相关代码,返回空列表替代
- 优化 AppTools 中异常处理,使用日志记录替代 printStackTrace
- 更新 BiliVideo 中视频下载链接和参数
- 替换 OpenPC 中的 Redis 操作为执行唤醒命令
- 更新 QQBotApplication版本号至 v.1.7.23
-简化 QQBotManager 中的版本信息输出
This commit is contained in:
yutou 2025-05-16 09:24:29 +08:00
parent dbec50b023
commit 95a5bf5467
6 changed files with 11 additions and 8 deletions

View File

@ -10,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class QQBotApplication {
public static final String version = "QQBot v.1.7.21";
public static final String version = "QQBot v.1.7.23";
public static void main(String[] args) {
System.out.println("version = " + version);

View File

@ -264,8 +264,8 @@ public class QQBotManager {
public void sendVersion() {
String localVersion = QQBotApplication.version;
String serverVersion = HttpTools.get("https://tools.yutou233.cn/public/version.do?token=zIrsh9TUZP2lfRW753PannG49E7VJvor");
String msg = "本地版本:" + localVersion + "\n" + "服务器版本:" + serverVersion;
//String serverVersion = HttpTools.get("https://tools.yutou233.cn/public/version.do?token=zIrsh9TUZP2lfRW753PannG49E7VJvor");
String msg = "当前版本:" + localVersion ;
QQBotManager.getInstance().sendMessage(msg);
// AppTools.sendServer("服务版本查询", msg);
}

View File

@ -80,7 +80,7 @@ public abstract class AbsGPTManager {
public abstract int setMaxMessageCount(int count);
public List<Message> getMessageList(String user){
List<Message> list = msgMap.computeIfAbsent(user, k -> Collections.synchronizedList(new ArrayList<>()));
/*List<Message> list = msgMap.computeIfAbsent(user, k -> Collections.synchronizedList(new ArrayList<>()));
// 限制历史消息的最大数量
synchronized (list) {
if (list.size() >= MAX_MESSAGE.get()) {
@ -88,7 +88,8 @@ public abstract class AbsGPTManager {
list.subList(0, removeCount).clear();
}
}
return list;
return list;*/
return new ArrayList<>();
}
/**
* 根据指定的类获取相应的GPT管理器实例

View File

@ -430,7 +430,7 @@ public class BiliVideo extends Model {
// int a=16|2048;
// System.out.println("a = " + a);
//video.downDanmu(428855000L,976216102L,"【都市_情感】《唐可可的诱惑》第一集",1);
video.downVideo("https://www.bilibili.com/bangumi/play/ep776259", false, false);// ep5
video.downVideo("https://www.bilibili.com/video/BV1su4m1u7gQ", true, false);// ep5
System.out.println("事件结束");
}
}

View File

@ -2,6 +2,7 @@ package com.yutou.qqbot.models.Commands.System;
import com.yutou.qqbot.Annotations.UseModel;
import com.yutou.qqbot.models.Model;
import com.yutou.qqbot.utlis.AppTools;
import com.yutou.qqbot.utlis.RedisTools;
import com.yutou.napcat.event.MessageEvent;
@ -30,7 +31,8 @@ public class OpenPC extends Model {
public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
super.onMessage(qq, event, isGroup);
if(msg.equals(QQGroupCommands.QQ_OPEN_PC)){
RedisTools.Consumer.system("openPC", null);
//RedisTools.Consumer.system("openPC", null);
AppTools.exec("wakeonlan 3C:7C:3F:20:88:7D",null,true,false);
}
}
}

View File

@ -82,7 +82,7 @@ public class AppTools {
process.destroy();
return ret;
} catch (Exception e) {
e.printStackTrace();
Log.e(e);
}
return "";
}