This commit is contained in:
yutou 2021-04-09 18:16:36 +08:00
parent 9b7633e8a9
commit 98d7ed7061
3 changed files with 9 additions and 4 deletions

View File

@ -477,6 +477,9 @@ public class Live implements ApplicationContextAware {
upData.setLive(1); upData.setLive(1);
LiveUtils.LiveInfoManager.getInstance().check(roomId); LiveUtils.LiveInfoManager.getInstance().check(roomId);
JSONObject liveInfo = LiveUtils.LiveInfoManager.getInstance().getInfo(roomId); JSONObject liveInfo = LiveUtils.LiveInfoManager.getInstance().getInfo(roomId);
if(liveInfo==null){
break;
}
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(upData.getName()).append("开播了!").append("\n"); builder.append(upData.getName()).append("开播了!").append("\n");
builder.append(liveInfo.getJSONObject("data").getJSONObject("room_info").getString("title")); builder.append(liveInfo.getJSONObject("data").getJSONObject("room_info").getString("title"));
@ -488,10 +491,7 @@ public class Live implements ApplicationContextAware {
} }
}); });
break; break;
case "PREPARING": case "PREPARING"://
upData.setLive(0);
QQBotManager.getInstance().sendMessage(upData.getName() + " 已下播");
break;
case "SUPER_CHAT_MESSAGE_JPN": case "SUPER_CHAT_MESSAGE_JPN":
case "NOTICE_MSG": case "NOTICE_MSG":
case "HOT_RANK_CHANGED"://榜单更新等无用信息 case "HOT_RANK_CHANGED"://榜单更新等无用信息

View File

@ -453,6 +453,8 @@ public class LiveUtils {
if (json != null) { if (json != null) {
Log.i("登记直播:"+roomId); Log.i("登记直播:"+roomId);
infoMap.put(roomId, json); infoMap.put(roomId, json);
}else{
infoMap.remove(roomId);
} }
} }

View File

@ -248,6 +248,9 @@ public class QQBotManager implements ApplicationContextAware {
builder.append("\n"); builder.append("\n");
for (Live live : Live.lives) { for (Live live : Live.lives) {
JSONObject liveJson = LiveUtils.LiveInfoManager.getInstance().getInfo(live.getInfo().getRoomid()); JSONObject liveJson = LiveUtils.LiveInfoManager.getInstance().getInfo(live.getInfo().getRoomid());
if(LiveUtils.isLivePlayer(live.getInfo().getRoomid())){
builder.append("[直播中]");
}
builder builder
.append("名字:").append(live.geData().getName()).append(" ") .append("名字:").append(live.geData().getName()).append(" ")
.append(" roomId:").append(live.geData().getRoomid()).append(" "); .append(" roomId:").append(live.geData().getRoomid()).append(" ");