Skip to content

Commit fa21067

Browse files
committed
更新10/16
1 parent ccd341c commit fa21067

File tree

7 files changed

+36
-28
lines changed

7 files changed

+36
-28
lines changed

conf.properties

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//?????QQ
2+
qq=0
3+
//???????
4+
pwd=0

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<dependency>
3737
<groupId>io.github.Kloping</groupId>
3838
<artifactId>SpringTool</artifactId>
39-
<version>0.0.5</version>
39+
<version>0.0.6</version>
4040
</dependency>
4141
</dependencies>
4242
</project>

readme.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ tips: 程序打jar包时 若确定 打包无误且仍无法加载主类<br>
4545

4646
使用方式与Console一致
4747

48-
若之前 拉取过项目 更新下 [pom.xml](https://github.com/Kloping/SimpleMiraiCore/blob/master/pom.xml)
49-
50-
创建包 Plugins 创建类 [Plugins.PluginLoader](hhttps://github.com/Kloping/SimpleMiraiCore/tree/master/src/main/core/com/hrs/Kloping/java/Plugins)
48+
若之前 拉取过项目 更新下 [pom.xml](https://github.com/Kloping/SimpleMiraiCore/blob/master/pom.xml)
49+
50+
创建包 Plugins
51+
创建类 [Plugins.PluginLoader](hhttps://github.com/Kloping/SimpleMiraiCore/tree/master/src/main/core/com/hrs/Kloping/java/Plugins)
5152

5253
复制其内容 至本地
5354

@@ -56,4 +57,6 @@ tips: 程序打jar包时 若确定 打包无误且仍无法加载主类<br>
5657
//加载插件
5758
PluginLoader.load(args);
5859

59-
即可
60+
即可
61+
62+
新增配置文件 conf.properties 避免重复打包

src/main/core/com/hrs/Kloping/Kotlin/BotStarter.kt

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package com.hrs.Kloping.Kotlin
22

3-
import com.hrs.Kloping.Kotlin.ListenerHosts.BaseMessageListener
4-
import com.hrs.Kloping.Kotlin.Plugins.PluginLoader
53
import com.hrs.MySpringTool.Starter
64
import com.hrs.MySpringTool.Starter.AllAfterOrBefore
5+
import com.hrs.MySpringTool.annotations.AutoStand
76
import com.hrs.MySpringTool.annotations.CommentScan
87
import com.hrs.MySpringTool.exceptions.NoRunException
98
import kotlinx.coroutines.runBlocking
@@ -22,11 +21,18 @@ import java.util.concurrent.Executors
2221

2322
@CommentScan(path = "com.hrs.Kloping.Kotlin")
2423
object BotStarter {
25-
const val qq = 0L
26-
const val password = ""
24+
25+
@AutoStand(id = "qq")
26+
var qq = 0L
27+
28+
@AutoStand(id = "pwd")
29+
var password = ""
2730

2831
@JvmStatic
2932
fun main(args: Array<String>) {
33+
// 启动 工具处理
34+
startSpring()
35+
//创建配置
3036
val botConfiguration = BotConfiguration()
3137
//登录协议
3238
botConfiguration.protocol = MiraiProtocol.ANDROID_PHONE
@@ -38,23 +44,22 @@ object BotStarter {
3844
botConfiguration.fileBasedDeviceInfo("./device.json")
3945
// 创建 Bot
4046
val bot = newBot(qq, password, botConfiguration)
47+
// 登录
4148
runBlocking {
42-
// 登录
4349
bot.login()
4450
}
4551
// 注册消息处理 通道
46-
bot.eventChannel.registerListenerHost(BaseMessageListener())
47-
// 启动 工具处理
48-
startSpring()
52+
bot.eventChannel.registerListenerHost(com.hrs.Kloping.java.ListenerHosts.BaseMessageListener())
4953
//加载插件
50-
PluginLoader.load(args)
54+
com.hrs.Kloping.java.Plugins.PluginLoader.load(args)
5155
}
5256

5357
val threads = Executors.newFixedThreadPool(20)
5458

5559
// 这里是关键点 不懂得话可以去看我的另一个github
5660
//https://github.com/Kloping/my-spring-tool
5761
private fun startSpring() {
62+
Starter.loadConfigurationFile("./conf.properties")
5863
Starter.run(BotStarter::class.java)
5964
Starter.setLog_Level(1)
6065
Starter.set_key(Class.forName("java.lang.Long"))

src/main/core/com/hrs/Kloping/Kotlin/controllers/BaseController.kt

-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ class BaseController() {
1919
return "你好,你好"
2020
}
2121

22-
@Action("[@" + BotStarter.qq + "]你好")
23-
fun hello_(): String {
24-
return "你好啊"
25-
}
26-
2722
@AutoStand
2823
var service: BaseService? = null
2924

src/main/core/com/hrs/Kloping/java/BotStarter.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.hrs.Kloping.java.ListenerHosts.BaseMessageListener;
44
import com.hrs.Kloping.java.Plugins.PluginLoader;
55
import com.hrs.MySpringTool.Starter;
6+
import com.hrs.MySpringTool.annotations.AutoStand;
67
import com.hrs.MySpringTool.annotations.CommentScan;
78
import com.hrs.MySpringTool.exceptions.NoRunException;
89
import net.mamoe.mirai.Bot;
@@ -22,10 +23,16 @@
2223

2324
@CommentScan(path = "com.hrs.Kloping.java")
2425
public class BotStarter {
25-
public static final long qq = 0L;
26-
public static final String password = "";
26+
27+
@AutoStand(id = "qq")
28+
public static Long qq = 0L;
29+
@AutoStand(id = "pwd")
30+
public static String password = "";
2731

2832
public static void main(String[] args) {
33+
// 启动 工具处理
34+
startSpring();
35+
//创建配置
2936
BotConfiguration botConfiguration = new BotConfiguration();
3037
//登录协议
3138
botConfiguration.setProtocol(BotConfiguration.MiraiProtocol.ANDROID_PHONE);
@@ -41,8 +48,6 @@ public static void main(String[] args) {
4148
bot.login();
4249
// 注册消息处理 通道
4350
bot.getEventChannel().registerListenerHost(new BaseMessageListener());
44-
// 启动 工具处理
45-
startSpring();
4651
//加载插件
4752
PluginLoader.load(args);
4853
}
@@ -52,6 +57,7 @@ public static void main(String[] args) {
5257
// 这里是关键点 不懂得话可以去看我的另一个github
5358
//https://github.com/Kloping/my-spring-tool
5459
private static void startSpring() {
60+
Starter.loadConfigurationFile("./conf.properties");
5561
Starter.run(BotStarter.class);
5662
Starter.setLog_Level(1);
5763
Starter.set_key(Long.class);

src/main/core/com/hrs/Kloping/java/controllers/BaseController.java

-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ public String hello() {
1818
return "你好,你好";
1919
}
2020

21-
@Action("[@" + BotStarter.qq + "]你好")
22-
public String hello_() {
23-
return "你好啊";
24-
}
25-
2621
@AutoStand
2722
BaseService service;
2823

0 commit comments

Comments
 (0)