@@ -12,6 +12,7 @@ import taboolib.module.metrics.Metrics
12
12
import top.alazeprt.aonebot.BotClient
13
13
import top.alazeprt.aonebot.action.SendGroupMessage
14
14
import top.alazeprt.aqqbot.qq.BotListener
15
+ import top.alazeprt.aqqbot.util.ACustom
15
16
import java.io.File
16
17
import java.net.URI
17
18
import javax.sql.DataSource
@@ -36,6 +37,8 @@ object AQQBot : Plugin() {
36
37
37
38
val dataMap: MutableMap <String , String > = mutableMapOf ()
38
39
40
+ val customCommands: MutableList <ACustom > = mutableListOf ()
41
+
39
42
lateinit var table: Table <* , * >
40
43
41
44
lateinit var dataSource: DataSource
@@ -95,6 +98,17 @@ object AQQBot : Plugin() {
95
98
botConfig = Configuration .loadFromFile(botFile)
96
99
val messageFile = releaseResourceFile(" messages.yml" , replace = false )
97
100
messageConfig = Configuration .loadFromFile(messageFile)
101
+ val customFile = releaseResourceFile(" custom.yml" , replace = false )
102
+ val customConfig = Configuration .loadFromFile(customFile)
103
+ customConfig.getKeys(false ).forEach {
104
+ if (customConfig.getBoolean(" $it .enable" )) {
105
+ val command = customConfig.getStringList(" $it .command" )
106
+ val output = customConfig.getStringList(" $it .output" )
107
+ val unbind_output = customConfig.getStringList(" $it .unbind_output" )
108
+ val format = customConfig.getBoolean(" $it .format" )
109
+ customCommands.add(ACustom (command, output, unbind_output, format))
110
+ }
111
+ }
98
112
dataConfig.getKeys(false ).forEach {
99
113
dataMap[it] = (dataConfig.getString(it)? : return @forEach)
100
114
}
0 commit comments