Skip to content

Commit

Permalink
fix configuration bugs
Browse files Browse the repository at this point in the history
change the base design of configuration data struct
  • Loading branch information
shandiankulishe committed Apr 16, 2022
1 parent 6eeb0fc commit df40394
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 70 deletions.
11 changes: 8 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ plugins {
}
mainClassName='glous.kleebot.KleeBot'
repositories {
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/'}
maven { url 'https://maven.aliyun.com/repository/jcenter/'}
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/'}
maven { url 'https://maven.aliyun.com/repository/jcenter/'}
maven {
url "https://packages.jetbrains.team/maven/p/skija/maven"
}
mavenCentral()
}

Expand Down Expand Up @@ -63,6 +66,8 @@ dependencies{
implementation 'org.seleniumhq.selenium:selenium-java:4.1.3'
implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
implementation 'com.github.oshi:oshi-core:6.1.5'
api 'org.jetbrains.skija:skija-windows:0.93.6'
api 'org.jetbrains.skija:skija-linux:0.93.1'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/glous/kleebot/KleeBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public static void main(String[] args) throws IOException {
Configuration configuration=new Configuration();
KleeBot.configurationInstance=configuration;
configuration.load(new File("kleebot.configuration"));
logger.debug("配置文件: "+configuration.toString());
config=configuration.serializeToClass(BotConfig.class);
File cacheDir=new File(KleeBot.config.getCacheDir());
if (!cacheDir.exists()){
Expand Down Expand Up @@ -237,7 +238,7 @@ public static void main(String[] args) throws IOException {
}
logger.trace("所有服务已完成初始化");
Bot bot = BotFactory.INSTANCE.newBot(config.getBotAccount(), config.getBotPassword(), botConfiguration -> {
botConfiguration.setProtocol(BotConfiguration.MiraiProtocol.ANDROID_PAD);
botConfiguration.setProtocol(BotConfiguration.MiraiProtocol.ANDROID_PHONE);
botConfiguration.fileBasedDeviceInfo();
botConfiguration.noBotLog();
botConfiguration.noNetworkLog();
Expand Down
45 changes: 45 additions & 0 deletions src/main/java/glous/kleebot/config/ConfigNode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package glous.kleebot.config;

public class ConfigNode {
public ConfigNode(String key, Object value, String comment) {
this.key = key;
this.value = value;
this.comment = comment;
}

public String getKey() {
return key;
}

public void setKey(String key) {
this.key = key;
}

public Object getValue() {
return value;
}

public void setValue(Object value) {
this.value = value;
}

public String getComment() {
if (comment==null){
return "";
}
return comment;
}

public void setComment(String comment) {
this.comment = comment;
}

@Override
public String toString() {
return "Key : %s Value : %s(Type: %s) Comment: %s".formatted(key,value,value.getClass().getName(),comment);
}

private String key;
private Object value;
private String comment;
}
27 changes: 0 additions & 27 deletions src/main/java/glous/kleebot/config/ConfigValue.java

This file was deleted.

Loading

1 comment on commit df40394

@vercel
Copy link

@vercel vercel bot commented on df40394 Apr 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kleebot – ./

kleebot-youfantan.vercel.app
kleebot-git-master-youfantan.vercel.app

Please sign in to comment.