更新QQ机器人
修复机器人协议问题
This commit is contained in:
parent
9fdf670c26
commit
a34fafc39c
17
KFCFactory.json
Normal file
17
KFCFactory.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
BIN
libs/fix-protocol-version-1.9.9.mirai2.jar
Normal file
BIN
libs/fix-protocol-version-1.9.9.mirai2.jar
Normal file
Binary file not shown.
15
pom.xml
15
pom.xml
@ -35,7 +35,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.mamoe</groupId>
|
<groupId>net.mamoe</groupId>
|
||||||
<artifactId>mirai-core-jvm</artifactId>
|
<artifactId>mirai-core-jvm</artifactId>
|
||||||
<version>2.15.0-RC</version>
|
<version>2.15.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlinx</groupId>
|
<groupId>org.jetbrains.kotlinx</groupId>
|
||||||
@ -77,6 +77,19 @@
|
|||||||
<scope>system</scope>
|
<scope>system</scope>
|
||||||
<systemPath>${project.basedir}/libs/json-jena-1.0.jar</systemPath>
|
<systemPath>${project.basedir}/libs/json-jena-1.0.jar</systemPath>
|
||||||
</dependency>
|
</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 -->
|
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.seleniumhq.selenium</groupId>
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
|
@ -12,6 +12,7 @@ import net.mamoe.mirai.message.MessageReceipt;
|
|||||||
import net.mamoe.mirai.message.data.*;
|
import net.mamoe.mirai.message.data.*;
|
||||||
import net.mamoe.mirai.utils.BotConfiguration;
|
import net.mamoe.mirai.utils.BotConfiguration;
|
||||||
import net.mamoe.mirai.utils.ExternalResource;
|
import net.mamoe.mirai.utils.ExternalResource;
|
||||||
|
import xyz.cssxsh.mirai.tool.FixProtocolVersion;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -47,12 +48,12 @@ public class QQBotManager {
|
|||||||
String password = ConfigTools.load(ConfigTools.CONFIG, "qq_password", String.class);
|
String password = ConfigTools.load(ConfigTools.CONFIG, "qq_password", String.class);
|
||||||
System.out.println("qq = " + qq);
|
System.out.println("qq = " + qq);
|
||||||
System.out.println("password = " + password);
|
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");
|
fileBasedDeviceInfo("qq_bot_devices_info.json");
|
||||||
if ("nas".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
|
if ("nas".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
|
||||||
noBotLog();
|
noBotLog();
|
||||||
@ -96,7 +97,7 @@ public class QQBotManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Image getImage(File file, Long qq) {
|
private Image getImage(File file, Long qq) {
|
||||||
if(file==null){
|
if (file == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (bot != null) {
|
if (bot != null) {
|
||||||
@ -152,7 +153,7 @@ public class QQBotManager {
|
|||||||
if (bot != null) {
|
if (bot != null) {
|
||||||
if (QQNumberManager.getManager().isGroup(group)) {
|
if (QQNumberManager.getManager().isGroup(group)) {
|
||||||
System.out.println("发群");
|
System.out.println("发群");
|
||||||
return Objects.requireNonNull(bot.getGroup(group)).sendMessage(builder.asMessageChain());
|
return Objects.requireNonNull(bot.getGroup(group)).sendMessage(builder.asMessageChain());
|
||||||
} else {
|
} else {
|
||||||
System.out.println("发个人");
|
System.out.println("发个人");
|
||||||
return Objects.requireNonNull(bot.getFriend(group)).sendMessage(builder.asMessageChain());
|
return Objects.requireNonNull(bot.getFriend(group)).sendMessage(builder.asMessageChain());
|
||||||
@ -176,7 +177,7 @@ public class QQBotManager {
|
|||||||
if (image != null) {
|
if (image != null) {
|
||||||
builder.append(image);
|
builder.append(image);
|
||||||
}
|
}
|
||||||
List<String> list=PatternTools.getQQ(text);
|
List<String> list = PatternTools.getQQ(text);
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
for (String _qq : list) {
|
for (String _qq : list) {
|
||||||
String[] tmp = text.split(_qq);
|
String[] tmp = text.split(_qq);
|
||||||
|
@ -195,7 +195,7 @@ public class GetSeTu extends Model {
|
|||||||
url = url.replace("&r18=0", "&r18=2").replace("&r18=1", "&r18=2");
|
url = url.replace("&r18=0", "&r18=2").replace("&r18=1", "&r18=2");
|
||||||
}
|
}
|
||||||
System.out.println("url = " + url);
|
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);
|
JSONObject json = JSON.parseObject(ret);
|
||||||
if (json.getJSONArray("data").size() == 0) {
|
if (json.getJSONArray("data").size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user