dev_该合并了 #8

Merged
yutou merged 83 commits from dev_ into master 2024-01-17 17:23:44 +08:00
Showing only changes of commit 00985e7fb8 - Show all commits

View File

@ -32,28 +32,31 @@ public class BiliBiliLive extends Model {
@Override @Override
public synchronized void onTime(Long qq, String time) { public synchronized void onTime(Long qq, String time) {
super.onTime(qq, time); super.onTime(qq, time);
if("00:01:00".equals(time)){ if ("00:01:00".equals(time)) {
QQBotManager.getInstance().sendMessage(qq, BiliBiliUtils.liveSignIn()); QQBotManager.getInstance().sendMessage(qq, BiliBiliUtils.liveSignIn());
Set<String> biliLive = RedisTools.list_get("bili_live"); Set<String> biliLive = RedisTools.list_get("bili_live");
StringBuilder builder=new StringBuilder(); StringBuilder builder = new StringBuilder();
for (String id : biliLive) { for (String id : biliLive) {
boolean sign = BiliBiliUtils.sendLiveDanmu(Integer.getInteger(id), "打卡"); boolean sign = BiliBiliUtils.sendLiveDanmu(Integer.getInteger(id), "打卡");
builder.append("BiliLiveSign ").append(id).append(":").append(sign).append("\n"); builder.append("BiliLiveSign ").append(id).append(":").append(sign).append("\n");
} }
QQBotManager.getInstance().sendMessage(qq,builder.toString()); QQBotManager.getInstance().sendMessage(qq, builder.toString());
} }
} }
@Override @Override
public void onMessage(Long qq, MessageEvent event, boolean isGroup) { public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
super.onMessage(qq, event, isGroup); super.onMessage(qq, event, isGroup);
if (!msg.startsWith(QQGroupCommands.BILI_LIVE_DANMU_SEND)) {
return;
}
StringBuilder message;
try { try {
Integer roomId = Integer.getInteger(msg); Integer roomId = Integer.getInteger(msg);
StringBuilder message; if (BiliBiliUtils.checkLiveRoom(roomId) && !RedisTools.list_isExist("bili_live", roomId + "")) {
if(BiliBiliUtils.checkLiveRoom(roomId)&&!RedisTools.list_isExist("bili_live",roomId+"")){ RedisTools.list_add("bili_live", roomId + "");
RedisTools.list_add("bili_live",roomId+"");
message = new StringBuilder("live sign Add Success"); message = new StringBuilder("live sign Add Success");
}else{ } else {
message = new StringBuilder("live sign Add Error\n"); message = new StringBuilder("live sign Add Error\n");
message.append("-----live sign roomId-----\n"); message.append("-----live sign roomId-----\n");
Set<String> biliLive = RedisTools.list_get("bili_live"); Set<String> biliLive = RedisTools.list_get("bili_live");
@ -61,10 +64,15 @@ public class BiliBiliLive extends Model {
message.append(id).append("\n"); message.append(id).append("\n");
} }
} }
QQBotManager.getInstance().sendMessage(qq,message.toString()); } catch (Exception e) {
}catch (Exception e){ message = new StringBuilder("live sign Add Error\n");
e.printStackTrace(); message.append("-----live sign roomId-----\n");
Set<String> biliLive = RedisTools.list_get("bili_live");
for (String id : biliLive) {
message.append(id).append("\n");
} }
}
QQBotManager.getInstance().sendMessage(qq, message.toString());
} }
} }