升级QQ机器人
调整直播状态代码 调整录像路径
This commit is contained in:
parent
251ebe1a0c
commit
d2f0be5adb
38
pom.xml
38
pom.xml
@ -15,7 +15,7 @@
|
|||||||
<description>Demo project for Spring Boot</description>
|
<description>Demo project for Spring Boot</description>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<kotlin.version>1.4.10</kotlin.version>
|
<kotlin.version>1.6.10</kotlin.version>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -54,23 +54,23 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.73</version>
|
<version>1.2.80</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.28.0</version>
|
<version>3.36.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.12</version>
|
<version>1.18.22</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.java-websocket</groupId>
|
<groupId>org.java-websocket</groupId>
|
||||||
<artifactId>Java-WebSocket</artifactId>
|
<artifactId>Java-WebSocket</artifactId>
|
||||||
<version>1.5.1</version>
|
<version>1.5.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
@ -80,45 +80,50 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>2.1.1</version>
|
<version>2.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi</artifactId>
|
<artifactId>poi</artifactId>
|
||||||
<version>3.17</version>
|
<version>5.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-scratchpad</artifactId>
|
<artifactId>poi-scratchpad</artifactId>
|
||||||
<version>3.17</version>
|
<version>5.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-ooxml</artifactId>
|
<artifactId>poi-ooxml</artifactId>
|
||||||
<version>3.17</version>
|
<version>5.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-ooxml-schemas</artifactId>
|
<artifactId>poi-ooxml-schemas</artifactId>
|
||||||
<version>3.17</version>
|
<version>4.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.mamoe</groupId>
|
<groupId>net.mamoe</groupId>
|
||||||
<artifactId>mirai-core-jvm</artifactId>
|
<artifactId>mirai-core-jvm</artifactId>
|
||||||
<version>2.5.0</version> <!-- 替换版本为你需要的版本 -->
|
<version>2.10.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlinx</groupId>
|
||||||
<artifactId>kotlin-stdlib</artifactId>
|
<artifactId>kotlinx-coroutines-jdk8</artifactId>
|
||||||
<version>${kotlin.version}</version>
|
<version>1.6.0-native-mt</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jetbrains.kotlinx</groupId>
|
||||||
|
<artifactId>kotlinx-coroutines-core-jvm</artifactId>
|
||||||
|
<version>1.6.0-native-mt</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
|
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>redis.clients</groupId>
|
<groupId>redis.clients</groupId>
|
||||||
<artifactId>jedis</artifactId>
|
<artifactId>jedis</artifactId>
|
||||||
<version>3.6.0-RC1</version>
|
<version>4.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
@ -181,9 +186,6 @@
|
|||||||
</goals>
|
</goals>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>
|
|
||||||
Z:\servier\biliob\
|
|
||||||
</outputDirectory>
|
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
|
@ -108,7 +108,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
private void updateUpInfo() {
|
private void updateUpInfo() {
|
||||||
try {
|
try {
|
||||||
upData = service.queryUp(upData);
|
upData = service.queryUp(upData);
|
||||||
upData.setLive(1);
|
//upData.setLive(1);
|
||||||
if (upData.getSavedanmu() == 1) {
|
if (upData.getSavedanmu() == 1) {
|
||||||
danmuManager = new BiliBiliLiveDatabasesManager();
|
danmuManager = new BiliBiliLiveDatabasesManager();
|
||||||
danmuManager.init("[" + AppTools.getToDayTime() + "]" + upData.getRoomid());
|
danmuManager.init("[" + AppTools.getToDayTime() + "]" + upData.getRoomid());
|
||||||
@ -329,7 +329,6 @@ public class Live implements ApplicationContextAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkLive() {
|
public void checkLive() {
|
||||||
|
|
||||||
boolean isLive = LiveUtils.isLivePlayer(roomId);
|
boolean isLive = LiveUtils.isLivePlayer(roomId);
|
||||||
upData.setLive(isLive ? 1 : 0);
|
upData.setLive(isLive ? 1 : 0);
|
||||||
System.out.println(roomId+"直播状态="+isLive);
|
System.out.println(roomId+"直播状态="+isLive);
|
||||||
@ -354,6 +353,9 @@ public class Live implements ApplicationContextAware {
|
|||||||
* @param bytes 原始hex数据
|
* @param bytes 原始hex数据
|
||||||
*/
|
*/
|
||||||
public void processData(String msg, byte[] bytes) {
|
public void processData(String msg, byte[] bytes) {
|
||||||
|
if(msg.contains("[object Object]")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
JSONObject json = JSONObject.parseObject(msg);
|
JSONObject json = JSONObject.parseObject(msg);
|
||||||
JSONObject data;
|
JSONObject data;
|
||||||
@ -552,6 +554,7 @@ public class Live implements ApplicationContextAware {
|
|||||||
checkLive();
|
checkLive();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(e);
|
Log.e(e);
|
||||||
|
Log.i("msg = "+msg);
|
||||||
// Log.i(AppTools.getToDayTimeToString(startTime), roomId, e.getLocalizedMessage());
|
// Log.i(AppTools.getToDayTimeToString(startTime), roomId, e.getLocalizedMessage());
|
||||||
/*try {
|
/*try {
|
||||||
JSONObject.parseObject(new String(bytes, StandardCharsets.UTF_8));
|
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.Live;
|
||||||
import com.yutou.bilibili.BiliBili.LiveUtils;
|
import com.yutou.bilibili.BiliBili.LiveUtils;
|
||||||
import com.yutou.bilibili.QQBot.QQBotManager;
|
import com.yutou.bilibili.QQBot.QQBotManager;
|
||||||
import com.yutou.bilibili.Tools.AppTools;
|
import com.yutou.bilibili.Tools.*;
|
||||||
import com.yutou.bilibili.Tools.FFmpegUtils;
|
|
||||||
import com.yutou.bilibili.Tools.HttpTools;
|
|
||||||
import com.yutou.bilibili.Tools.Log;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
@ -140,7 +137,8 @@ public class SaveLive {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ffmpegDownload(String url) throws Exception {
|
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,
|
File.separator,
|
||||||
AppTools.getToDayTime(),
|
AppTools.getToDayTime(),
|
||||||
File.separator,
|
File.separator,
|
||||||
@ -189,7 +187,8 @@ public class SaveLive {
|
|||||||
heartbeats.put(roomId, heartbeat);
|
heartbeats.put(roomId, heartbeat);
|
||||||
//heartbeats.add(beat);
|
//heartbeats.add(beat);
|
||||||
InputStream inputStream = connection.getInputStream();
|
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,
|
File.separator,
|
||||||
AppTools.getToDayTime(),
|
AppTools.getToDayTime(),
|
||||||
File.separator,
|
File.separator,
|
||||||
|
@ -13,7 +13,7 @@ import org.springframework.context.annotation.Import;
|
|||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class BilibiliApplication {
|
public class BilibiliApplication {
|
||||||
|
|
||||||
public static String version="0.8";
|
public static String version="0.8.3";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
QQBotManager.getInstance().init();
|
QQBotManager.getInstance().init();
|
||||||
|
@ -84,9 +84,7 @@ public class QQBotManager implements ApplicationContextAware {
|
|||||||
if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "qq_bot"))) {
|
if (!((boolean) ConfigTools.load(ConfigTools.CONFIG, "qq_bot"))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new Thread(new Runnable() {
|
new Thread(() -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
long qq = Long.parseLong((String) ConfigTools.load(ConfigTools.CONFIG, "qq_number"));
|
long qq = Long.parseLong((String) ConfigTools.load(ConfigTools.CONFIG, "qq_number"));
|
||||||
String password = (String) ConfigTools.load(ConfigTools.CONFIG, "qq_password");
|
String password = (String) ConfigTools.load(ConfigTools.CONFIG, "qq_password");
|
||||||
bot = BotFactory.INSTANCE.newBot(qq, password, new BotConfiguration() {
|
bot = BotFactory.INSTANCE.newBot(qq, password, new BotConfiguration() {
|
||||||
@ -112,7 +110,7 @@ public class QQBotManager implements ApplicationContextAware {
|
|||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
com.yutou.bilibili.Tools.Log.e(e);
|
Log.e(e);
|
||||||
}
|
}
|
||||||
String str = sendMessage("姬妻酱上线拉~");
|
String str = sendMessage("姬妻酱上线拉~");
|
||||||
Log.i(str);
|
Log.i(str);
|
||||||
@ -121,7 +119,6 @@ public class QQBotManager implements ApplicationContextAware {
|
|||||||
}).start();
|
}).start();
|
||||||
bot.join();
|
bot.join();
|
||||||
|
|
||||||
}
|
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -256,7 +253,7 @@ public class QQBotManager implements ApplicationContextAware {
|
|||||||
getInstance().sendMessage("正在重启服务");
|
getInstance().sendMessage("正在重启服务");
|
||||||
System.out.println("结束进程");
|
System.out.println("结束进程");
|
||||||
try {
|
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) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user