File tree 5 files changed +18
-12
lines changed
5 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 2
2
.idea /
3
3
build /
4
4
out /
5
- kotbot.config.json
5
+ kotbot.config.hjson
6
6
kotbotdb
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ dependencies {
18
18
implementation(" org.graalvm.sdk:graal-sdk:1.0.0-rc16" )
19
19
implementation(" com.beust:klaxon:5.0.1" )
20
20
implementation(" org.xerial:sqlite-jdbc:3.27.2.1" )
21
+ implementation(" org.hjson:hjson:3.0.0" )
21
22
implementation(kotlin(" stdlib-jdk8" ))
22
23
}
23
24
Original file line number Diff line number Diff line change
1
+ {
2
+ username: kotbot,
3
+ hostname: "localhost",
4
+ channel: "#example",
5
+ port: 6667,
6
+ identify_password: "",
7
+ identify_owner: "",
8
+ command_prefix: ".",
9
+ openweathermap: ""
10
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ package us.kesslern.kotbot
2
2
3
3
import com.beust.klaxon.JsonObject
4
4
import com.beust.klaxon.Parser
5
+ import org.hjson.JsonValue
6
+ import java.io.File
5
7
import java.io.FileNotFoundException
6
8
7
9
/* *
@@ -13,7 +15,10 @@ object ConfigurationFile {
13
15
init {
14
16
val parser: Parser = Parser .default()
15
17
try {
16
- json = parser.parse(" ./kotbot.config.json" ) as JsonObject
18
+ val hjson = File (" ./kotbot.config.hjson" ).readText(Charsets .UTF_8 )
19
+ val stream = StringBuilder ()
20
+ stream.append(JsonValue .readHjson(hjson))
21
+ json = parser.parse(stream) as JsonObject
17
22
} catch (e: FileNotFoundException ) {
18
23
throw RuntimeException (" Cannot find configuration file kotbot.config.json" )
19
24
}
You can’t perform that action at this time.
0 commit comments