From 98d7ed70617ee80ceb902294971220f8545c9ec4 Mon Sep 17 00:00:00 2001 From: yutou Date: Fri, 9 Apr 2021 18:16:36 +0800 Subject: [PATCH] update --- src/main/java/com/yutou/bilibili/BiliBili/Live.java | 8 ++++---- src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java | 2 ++ src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/yutou/bilibili/BiliBili/Live.java b/src/main/java/com/yutou/bilibili/BiliBili/Live.java index 616b6cc..baa41c9 100644 --- a/src/main/java/com/yutou/bilibili/BiliBili/Live.java +++ b/src/main/java/com/yutou/bilibili/BiliBili/Live.java @@ -477,6 +477,9 @@ public class Live implements ApplicationContextAware { upData.setLive(1); LiveUtils.LiveInfoManager.getInstance().check(roomId); JSONObject liveInfo = LiveUtils.LiveInfoManager.getInstance().getInfo(roomId); + if(liveInfo==null){ + break; + } StringBuilder builder = new StringBuilder(); builder.append(upData.getName()).append("开播了!").append("\n"); builder.append(liveInfo.getJSONObject("data").getJSONObject("room_info").getString("title")); @@ -488,10 +491,7 @@ public class Live implements ApplicationContextAware { } }); break; - case "PREPARING": - upData.setLive(0); - QQBotManager.getInstance().sendMessage(upData.getName() + " 已下播"); - break; + case "PREPARING":// case "SUPER_CHAT_MESSAGE_JPN": case "NOTICE_MSG": case "HOT_RANK_CHANGED"://榜单更新等无用信息 diff --git a/src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java b/src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java index e851f61..14c5068 100644 --- a/src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java +++ b/src/main/java/com/yutou/bilibili/BiliBili/LiveUtils.java @@ -453,6 +453,8 @@ public class LiveUtils { if (json != null) { Log.i("登记直播:"+roomId); infoMap.put(roomId, json); + }else{ + infoMap.remove(roomId); } } diff --git a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java index 6ae3b62..7038bd6 100644 --- a/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java +++ b/src/main/java/com/yutou/bilibili/QQBot/QQBotManager.java @@ -248,6 +248,9 @@ public class QQBotManager implements ApplicationContextAware { builder.append("\n"); for (Live live : Live.lives) { JSONObject liveJson = LiveUtils.LiveInfoManager.getInstance().getInfo(live.getInfo().getRoomid()); + if(LiveUtils.isLivePlayer(live.getInfo().getRoomid())){ + builder.append("[直播中]"); + } builder .append("名字:").append(live.geData().getName()).append(" ") .append(" roomId:").append(live.geData().getRoomid()).append(" ");