升级QQ机器人
调整直播状态代码 调整录像路径
This commit is contained in:
@@ -108,7 +108,7 @@ public class Live implements ApplicationContextAware {
|
||||
private void updateUpInfo() {
|
||||
try {
|
||||
upData = service.queryUp(upData);
|
||||
upData.setLive(1);
|
||||
//upData.setLive(1);
|
||||
if (upData.getSavedanmu() == 1) {
|
||||
danmuManager = new BiliBiliLiveDatabasesManager();
|
||||
danmuManager.init("[" + AppTools.getToDayTime() + "]" + upData.getRoomid());
|
||||
@@ -329,7 +329,6 @@ public class Live implements ApplicationContextAware {
|
||||
}
|
||||
|
||||
public void checkLive() {
|
||||
|
||||
boolean isLive = LiveUtils.isLivePlayer(roomId);
|
||||
upData.setLive(isLive ? 1 : 0);
|
||||
System.out.println(roomId+"直播状态="+isLive);
|
||||
@@ -354,6 +353,9 @@ public class Live implements ApplicationContextAware {
|
||||
* @param bytes 原始hex数据
|
||||
*/
|
||||
public void processData(String msg, byte[] bytes) {
|
||||
if(msg.contains("[object Object]")){
|
||||
return;
|
||||
}
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(msg);
|
||||
JSONObject data;
|
||||
@@ -552,6 +554,7 @@ public class Live implements ApplicationContextAware {
|
||||
checkLive();
|
||||
} catch (Exception e) {
|
||||
Log.e(e);
|
||||
Log.i("msg = "+msg);
|
||||
// Log.i(AppTools.getToDayTimeToString(startTime), roomId, e.getLocalizedMessage());
|
||||
/*try {
|
||||
JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));
|
||||
|
||||
@@ -5,10 +5,7 @@ import com.yutou.bilibili.BiliBili.Datas.AppData;
|
||||
import com.yutou.bilibili.BiliBili.Live;
|
||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||
import com.yutou.bilibili.QQBot.QQBotManager;
|
||||
import com.yutou.bilibili.Tools.AppTools;
|
||||
import com.yutou.bilibili.Tools.FFmpegUtils;
|
||||
import com.yutou.bilibili.Tools.HttpTools;
|
||||
import com.yutou.bilibili.Tools.Log;
|
||||
import com.yutou.bilibili.Tools.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
@@ -140,7 +137,8 @@ public class SaveLive {
|
||||
}
|
||||
|
||||
private void ffmpegDownload(String url) throws Exception {
|
||||
liveFile = new File(String.format("live%s%s%s[%s]%d.mp4",
|
||||
liveFile = new File(String.format("%slive%s%s%s[%s]%d.mp4",
|
||||
ConfigTools.load(ConfigTools.CONFIG,"liveSavePath"),
|
||||
File.separator,
|
||||
AppTools.getToDayTime(),
|
||||
File.separator,
|
||||
@@ -189,7 +187,8 @@ public class SaveLive {
|
||||
heartbeats.put(roomId, heartbeat);
|
||||
//heartbeats.add(beat);
|
||||
InputStream inputStream = connection.getInputStream();
|
||||
liveFile = new File(String.format("live%s%s%s[%s]%d.mp4",
|
||||
liveFile = new File(String.format("%slive%s%s%s[%s]%d.mp4",
|
||||
ConfigTools.load(ConfigTools.CONFIG,"liveSavePath"),
|
||||
File.separator,
|
||||
AppTools.getToDayTime(),
|
||||
File.separator,
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springframework.context.annotation.Import;
|
||||
@SpringBootApplication
|
||||
public class BilibiliApplication {
|
||||
|
||||
public static String version="0.8";
|
||||
public static String version="0.8.3";
|
||||
|
||||
public static void main(String[] args) {
|
||||
QQBotManager.getInstance().init();
|
||||
|
||||
@@ -84,44 +84,41 @@ public class QQBotManager implements ApplicationContextAware {
|
||||
if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "qq_bot"))) {
|
||||
return;
|
||||
}
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
long qq = Long.parseLong((String) ConfigTools.load(ConfigTools.CONFIG, "qq_number"));
|
||||
String password = (String) ConfigTools.load(ConfigTools.CONFIG, "qq_password");
|
||||
bot = BotFactory.INSTANCE.newBot(qq, password, new BotConfiguration() {
|
||||
{
|
||||
setProtocol(MiraiProtocol.ANDROID_PAD);
|
||||
fileBasedDeviceInfo("qq_bot_devices_info.json");
|
||||
if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "qq_debug"))) {
|
||||
noBotLog();
|
||||
noNetworkLog();
|
||||
}
|
||||
new Thread(() -> {
|
||||
long qq = Long.parseLong((String) ConfigTools.load(ConfigTools.CONFIG, "qq_number"));
|
||||
String password = (String) ConfigTools.load(ConfigTools.CONFIG, "qq_password");
|
||||
bot = BotFactory.INSTANCE.newBot(qq, password, new BotConfiguration() {
|
||||
{
|
||||
setProtocol(MiraiProtocol.ANDROID_PAD);
|
||||
fileBasedDeviceInfo("qq_bot_devices_info.json");
|
||||
if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "qq_debug"))) {
|
||||
noBotLog();
|
||||
noNetworkLog();
|
||||
}
|
||||
});
|
||||
//Events.registerEvents(bot, new MessageListener());
|
||||
GlobalEventChannel.INSTANCE.subscribeAlways(GroupMessageEvent.class, new MessageListener());
|
||||
Log.i("准备登陆");
|
||||
bot.login();
|
||||
Log.i("登陆成功");
|
||||
isLogin = true;
|
||||
isInit = true;
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
com.yutou.bilibili.Tools.Log.e(e);
|
||||
}
|
||||
String str = sendMessage("姬妻酱上线拉~");
|
||||
Log.i(str);
|
||||
|
||||
}
|
||||
});
|
||||
//Events.registerEvents(bot, new MessageListener());
|
||||
GlobalEventChannel.INSTANCE.subscribeAlways(GroupMessageEvent.class, new MessageListener());
|
||||
Log.i("准备登陆");
|
||||
bot.login();
|
||||
Log.i("登陆成功");
|
||||
isLogin = true;
|
||||
isInit = true;
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}).start();
|
||||
bot.join();
|
||||
String str = sendMessage("姬妻酱上线拉~");
|
||||
Log.i(str);
|
||||
|
||||
}
|
||||
}).start();
|
||||
bot.join();
|
||||
|
||||
}
|
||||
}).start();
|
||||
|
||||
}
|
||||
@@ -256,7 +253,7 @@ public class QQBotManager implements ApplicationContextAware {
|
||||
getInstance().sendMessage("正在重启服务");
|
||||
System.out.println("结束进程");
|
||||
try {
|
||||
AppTools.exec("cd /media/yutou/4t/public/servier/biliob && ./start.sh");
|
||||
AppTools.exec("cd /home/yutou/public/servier/biliob && ./start.sh");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user