更新QQ机器人

修复机器人协议问题
This commit is contained in:
yutou 2023-07-25 16:04:50 +08:00
parent 9fdf670c26
commit a34fafc39c
5 changed files with 39 additions and 8 deletions

17
KFCFactory.json Normal file
View File

@ -0,0 +1,17 @@
{
"8.9.63": {
"base_url": "http://192.168.31.88:7400",
"type": "fuqiuluo/unidbg-fetch-qsign",
"key": "114514"
},
"0.1.0": {
"base_url": "http://127.0.0.1:8888",
"type": "kiliokuara/magic-signer-guide",
"server_identity_key": "vivo50",
"authorization_key": "kfc"
},
"8.8.88": {
"base_url": "http://127.0.0.1:80",
"type": "TLV544Provider"
}
}

Binary file not shown.

15
pom.xml
View File

@ -35,7 +35,7 @@
<dependency>
<groupId>net.mamoe</groupId>
<artifactId>mirai-core-jvm</artifactId>
<version>2.15.0-RC</version>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
@ -77,6 +77,19 @@
<scope>system</scope>
<systemPath>${project.basedir}/libs/json-jena-1.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.fix-protocol-version.mirai2</groupId>
<artifactId>mirai2</artifactId>
<version>1.9.9</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/fix-protocol-version-1.9.9.mirai2.jar</systemPath>
</dependency>
<!-- QQ协议修复的依赖 -->
<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
<version>2.12.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>

View File

@ -12,6 +12,7 @@ import net.mamoe.mirai.message.MessageReceipt;
import net.mamoe.mirai.message.data.*;
import net.mamoe.mirai.utils.BotConfiguration;
import net.mamoe.mirai.utils.ExternalResource;
import xyz.cssxsh.mirai.tool.FixProtocolVersion;
import java.io.File;
import java.io.IOException;
@ -47,12 +48,12 @@ public class QQBotManager {
String password = ConfigTools.load(ConfigTools.CONFIG, "qq_password", String.class);
System.out.println("qq = " + qq);
System.out.println("password = " + password);
FixProtocolVersion.fix();
FixProtocolVersion.load(BotConfiguration.MiraiProtocol.ANDROID_PAD);
bot = BotFactory.INSTANCE.newBot(qq, BotAuthorization.byQRCode(),new BotConfiguration() {
bot = BotFactory.INSTANCE.newBot(qq, password, new BotConfiguration() {
{
setProtocol(MiraiProtocol.ANDROID_WATCH);
setProtocol(MiraiProtocol.ANDROID_PAD);
fileBasedDeviceInfo("qq_bot_devices_info.json");
if ("nas".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
noBotLog();
@ -96,7 +97,7 @@ public class QQBotManager {
}
private Image getImage(File file, Long qq) {
if(file==null){
if (file == null) {
return null;
}
if (bot != null) {
@ -152,7 +153,7 @@ public class QQBotManager {
if (bot != null) {
if (QQNumberManager.getManager().isGroup(group)) {
System.out.println("发群");
return Objects.requireNonNull(bot.getGroup(group)).sendMessage(builder.asMessageChain());
return Objects.requireNonNull(bot.getGroup(group)).sendMessage(builder.asMessageChain());
} else {
System.out.println("发个人");
return Objects.requireNonNull(bot.getFriend(group)).sendMessage(builder.asMessageChain());
@ -176,7 +177,7 @@ public class QQBotManager {
if (image != null) {
builder.append(image);
}
List<String> list=PatternTools.getQQ(text);
List<String> list = PatternTools.getQQ(text);
if (!list.isEmpty()) {
for (String _qq : list) {
String[] tmp = text.split(_qq);

View File

@ -195,7 +195,7 @@ public class GetSeTu extends Model {
url = url.replace("&r18=0", "&r18=2").replace("&r18=1", "&r18=2");
}
System.out.println("url = " + url);
String ret = HttpTools.http_get(url, null, true);
String ret = HttpTools.http_get(url, null, false);
JSONObject json = JSON.parseObject(ret);
if (json.getJSONArray("data").size() == 0) {
return false;