更新FastJSON
调整ChromeDriver参数
This commit is contained in:
parent
4031b07b0b
commit
e0f81620a3
2
pom.xml
2
pom.xml
@ -60,7 +60,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>2.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.yutou.qqbot;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONFactory;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.qqbot.Listeners.QQMessageListener;
|
||||
import com.yutou.qqbot.MessageEvent.Message;
|
||||
import com.yutou.qqbot.models.Animal.TurnipProphet;
|
||||
@ -27,6 +30,7 @@ import net.mamoe.mirai.utils.ExternalResource;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -57,6 +61,7 @@ public class QQBotManager {
|
||||
Model.classList.add(BiliBiliMangeSign.class);
|
||||
Model.classList.add(Moyu.class);
|
||||
}
|
||||
|
||||
private static QQBotManager botManager = null;
|
||||
private Bot bot;
|
||||
private static final long qqGroup = 891655174L;
|
||||
@ -79,6 +84,10 @@ public class QQBotManager {
|
||||
public void run() {
|
||||
long qq = ConfigTools.load(ConfigTools.CONFIG, "qq_number", Long.class);
|
||||
String password = ConfigTools.load(ConfigTools.CONFIG, "qq_password", String.class);
|
||||
System.out.println("qq = " + qq);
|
||||
System.out.println("password = " + password);
|
||||
qq=3620756944L;
|
||||
password="UAs6YBYMyxJU";
|
||||
bot = BotFactory.INSTANCE.newBot(qq, password, new BotConfiguration() {
|
||||
{
|
||||
setProtocol(MiraiProtocol.ANDROID_PAD);
|
||||
@ -183,9 +192,11 @@ public class QQBotManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String sendMessage(File imageFile, Long qq, String text) {
|
||||
return sendMessage(imageFile, qq, null, text);
|
||||
}
|
||||
|
||||
public String sendMessage(File imageFile, Long qq, MessageChain replyMessage, String text) {
|
||||
try {
|
||||
if (bot != null) {
|
||||
@ -210,6 +221,7 @@ public class QQBotManager {
|
||||
|
||||
return getNotLoginQQ();
|
||||
}
|
||||
|
||||
public String sendMessage(File imageFile, String text) {
|
||||
return sendMessage(imageFile, qqGroup, text);
|
||||
}
|
||||
@ -232,9 +244,14 @@ public class QQBotManager {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
getInstance();
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("t1", 3234567890L);
|
||||
System.out.println("json = " + json);
|
||||
|
||||
String tmp=json.toString();
|
||||
JSONObject json2=JSON.parseObject(tmp);
|
||||
System.out.println("json2 = " + json2);
|
||||
}
|
||||
|
||||
public void sendVersion() {
|
||||
|
@ -45,9 +45,10 @@ public class ConfigTools {
|
||||
String src = readFile(file);
|
||||
if (src != null) {
|
||||
try {
|
||||
JSONObject json = JSON.parseObject(src);
|
||||
JSONObject json = JSONObject.parseObject(src,JSONObject.class);
|
||||
return json.getObject(key, t);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ public class WebClient {
|
||||
private WebClient() {
|
||||
System.setProperty("webdriver.chrome.driver",
|
||||
ConfigTools.load(ConfigTools.CONFIG, "chrome", String.class));
|
||||
System.setProperty("webdriver.chrome.whitelistedIps", "");
|
||||
// java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user