Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kloping committed May 12, 2022
1 parent 5a862be commit a3975c8
Show file tree
Hide file tree
Showing 48 changed files with 249 additions and 443 deletions.
9 changes: 7 additions & 2 deletions Lsys-GameBase/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.github.kloping</groupId>
<artifactId>MiraiLSys</artifactId>
<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -16,6 +16,11 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>io.github.kloping</groupId>
<artifactId>MiraiLSys</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>io.github.Kloping</groupId>
<artifactId>SpringTool</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ public Game0() {
super(new JvmPluginDescriptionBuilder("o.github.lsys.gameBase.game0", "1.0")
.name("plugin_10 Author-HRS-LSys-game-Loaded")
.info("plugin-gb")
.dependsOn("cn.kloping.Lsys","1.0",true)
.author("HRS")
.build());
}


@Override
public void onLoad(@NotNull PluginComponentStorage thisOnLoad) {
if (!Utils.isExits()) {
getLogger().error("欲使用game0插件 必须安装 Lsys 插件");
getLogger().error("欲使用game0插件 必须安装 Lsys 插件");
getLogger().error("欲使用game0插件 必须安装 Lsys 插件");
PluginManager.INSTANCE.disablePlugin(INSTANCE);
return;
}
Game0Loader.load();
}

Expand Down
23 changes: 0 additions & 23 deletions Lsys-GameBase/src/main/java/cn/kloping/lsys/gamebase/Utils.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ data class Game0Conf(
var cd: Long = 3 * 60 * 60 * 1000L,
var stopFrom: String = "23:00",
var stopEnd: String = "5:00",
var objs: String = "./conf/lsys/game0/objs.json",
var objs: String = "./conf/lSys/game0/objs.json",
) {
}
12 changes: 9 additions & 3 deletions Lsys-GetPic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.example</groupId>
<groupId>io.github.kloping</groupId>
<artifactId>MiraiLSys</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand All @@ -15,5 +15,11 @@
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>io.github.kloping</groupId>
<artifactId>MiraiLSys</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>
30 changes: 4 additions & 26 deletions Lsys-GetPic/src/main/java/cn/kloping/lsys/getPic/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class Loader {
public static Conf conf = new Conf(0, 12);

public static final String BASE_URL = "http://49.232.209.180:20041/api/search/pic?keyword=%s&num=%s&type=%s";
public static final String BASE_URL = "http://kloping.life/api/search/pic?keyword=%s&num=%s&type=%s";

public static final InvokeGroup INVOKE_GROUP = new InvokeGroup("getPic");

Expand All @@ -45,7 +45,7 @@ public class Loader {
INVOKE_GROUP.getInvokes().put("堆糖搜图.*", "getDuitPics");
INVOKE_GROUP.getInvokesAfter().put("堆糖搜图.*", new String[]{"搜索到了$1个结果", "获取失败"});

conf = FileInitializeValue.getValue(Resource.rootPath + "/conf/Lsys/lsys-getPic.json", conf, true);
conf = FileInitializeValue.getValue(Resource.ROOT_PATH + "/conf/LSys/lsys-getPic.json", conf, true);
}

public static final Function2<User, Request, Result> FUN2 = (user, request) -> {
Expand Down Expand Up @@ -145,34 +145,12 @@ private static void startCd() {
return new Result(new Object[]{}, 1);
};

// public static synchronized Image createImageInGroup(Contact group, String path) {
// try {
// if (path.startsWith("http")) {
// return Contact.uploadImage(group, new URL(path).openStream());
// } else if (path.startsWith("{")) {
// return Image.fromId(path);
// } else {
// Image image = null;
// image = Contact.uploadImage(group, new File(path));
// return image;
// }
// } catch (IOException e) {
// System.err.println(path + "加载重试");
// try {
// return Contact.uploadImage(group, new URL(path).openStream());
// } catch (IOException ioException) {
// ioException.printStackTrace();
// return null;
// }
// }
// }

public static void loadConf() {
conf = FileInitializeValue.getValue(Resource.rootPath + "/conf/Lsys/lsys-getPic.json", conf, true);
conf = FileInitializeValue.getValue(Resource.ROOT_PATH + "/conf/LSys/lsys-getPic.json", conf, true);
}

public static void applyConf() {
FileInitializeValue.putValues(Resource.rootPath + "/conf/Lsys/lsys-getPic.json", conf, true);
FileInitializeValue.putValues(Resource.ROOT_PATH + "/conf/LSys/lsys-getPic.json", conf, true);
}

public static final Runnable RUNNABLE = () -> {
Expand Down
15 changes: 6 additions & 9 deletions Lsys-GetPic/src/main/java/cn/kloping/lsys/getPic/PluginMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,23 @@
import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescriptionBuilder;
import org.jetbrains.annotations.NotNull;

/**
* @author github-kloping
*/
public class PluginMain extends JavaPlugin {
public static final PluginMain INSTANCE = new PluginMain();

private PluginMain() {
super(new JvmPluginDescriptionBuilder("cn.kloping.lsys.getPic.PluginMain", "0.1")
super(new JvmPluginDescriptionBuilder("cn.kloping.lsys.getPic.PluginMain", "1.0")
.name("plugin_4 Author - HRS LSys GetPic Loaded")
.info("plugin-pic")
.author("HRS")
.dependsOn("cn.kloping.Lsys","1.0",true)
.build());
}

@Override
public void onLoad(@NotNull PluginComponentStorage $this$onLoad) {
if (!Utils.isExits()) {
getLogger().error("欲使用GetPic插件 必须安装 Lsys 插件");
getLogger().error("欲使用GetPic插件 必须安装 Lsys 插件");
getLogger().error("欲使用GetPic插件 必须安装 Lsys 插件");
PluginManager.INSTANCE.disablePlugin(INSTANCE);
return;
}
public void onLoad(@NotNull PluginComponentStorage load) {
Loader.load();
}

Expand Down
19 changes: 0 additions & 19 deletions Lsys-GetPic/src/main/java/cn/kloping/lsys/getPic/Utils.java

This file was deleted.

11 changes: 8 additions & 3 deletions Lsys-GetSong/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.github.kloping</groupId>
<artifactId>MiraiLSys</artifactId>
<groupId>org.example</groupId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>Lsys-GetSong</artifactId>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>
<dependency>
<groupId>io.github.kloping</groupId>
<artifactId>MiraiLSys</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

<properties>
Expand Down
45 changes: 26 additions & 19 deletions Lsys-GetSong/src/main/java/cn/kloping/lsys/getSong/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
* @author github-kloping
*/
public class Loader {
public static final String baseUrl = "http://49.232.209.180:20041/api/search/song?keyword=%s&type=%s";
private static final Function2<User, Request, Result> pointKugou = (user, request) -> {

public static final String BASE_URL = "http://kloping.life/api/search/song?keyword=%s&type=%s";

private static final Function2<User, Request, Result> POINT_KUGOU = (user, request) -> {
try {
int i = request.getOStr().indexOf(".");
String name = request.getStr().substring(i).trim();
Expand All @@ -36,7 +41,8 @@ public class Loader {
return new Result(new Object[]{}, 1);
}
};
private static final Function2<User, Request, Result> pointQQ = (user, request) -> {

private static final Function2<User, Request, Result> POINT_QQ = (user, request) -> {
try {
int i = request.getOStr().indexOf(".");
String name = request.getStr().substring(i).trim();
Expand All @@ -56,7 +62,8 @@ public class Loader {
return new Result(new Object[]{}, 1);
}
};
private static final Function2<User, Request, Result> pointWy = (user, request) -> {

private static final Function2<User, Request, Result> POINT_WY = (user, request) -> {
try {
int i = request.getOStr().indexOf(".");
String name = request.getStr().substring(i).trim();
Expand All @@ -77,37 +84,37 @@ public class Loader {
}
};

public static final InvokeGroup invokeGroup = new InvokeGroup("getSong");
public static final InvokeGroup INVOKE_GROUP = new InvokeGroup("getSong");

static {
invokeGroup.getInvokes().put("酷狗点歌.*", "pointKugou");
invokeGroup.getInvokes().put("QQ点歌.*", "pointQQ");
invokeGroup.getInvokes().put("网易点歌.*", "pointWy");
invokeGroup.getInvokes().put("点歌系统", "method");
INVOKE_GROUP.getInvokes().put("酷狗点歌.*", "pointKugou");
INVOKE_GROUP.getInvokes().put("QQ点歌.*", "pointQQ");
INVOKE_GROUP.getInvokes().put("网易点歌.*", "pointWy");
INVOKE_GROUP.getInvokes().put("点歌系统", "method");
//========================
invokeGroup.getInvokesAfter().put("酷狗点歌.*", new String[]{"<$1 = $2, $3, $4, https://www.kugou.com/, $6, $7>", "<At = ?>点歌失败"});
invokeGroup.getInvokesAfter().put("QQ点歌.*", new String[]{"<$1 = $2, $3, $4, https://y.qq.com/, $6, $7>", "<At = ?>点歌失败"});
invokeGroup.getInvokesAfter().put("网易点歌.*", new String[]{"<$1 = $2, $3, $4, https://music.163.com/, $6, $7>", "<At = ?>点歌失败"});
invokeGroup.getInvokesAfter().put("点歌系统", new String[]{"<At = ?>\n点歌系统\n酷狗点歌 歌名\n网易点歌 歌名\nQQ点歌 歌名"});
INVOKE_GROUP.getInvokesAfter().put("酷狗点歌.*", new String[]{"<$1 = $2, $3, $4, https://www.kugou.com/, $6, $7>", "<At = ?>点歌失败"});
INVOKE_GROUP.getInvokesAfter().put("QQ点歌.*", new String[]{"<$1 = $2, $3, $4, https://y.qq.com/, $6, $7>", "<At = ?>点歌失败"});
INVOKE_GROUP.getInvokesAfter().put("网易点歌.*", new String[]{"<$1 = $2, $3, $4, https://music.163.com/, $6, $7>", "<At = ?>点歌失败"});
INVOKE_GROUP.getInvokesAfter().put("点歌系统", new String[]{"<At = ?>\n点歌系统\n酷狗点歌 歌名\n网易点歌 歌名\nQQ点歌 歌名"});
}

public static final Runnable runnable = () -> {
if (!Resource.conf.getInvokeGroups().containsKey(invokeGroup.getId()))
Resource.conf.getInvokeGroups().put(invokeGroup.getId(), invokeGroup);
if (!Resource.conf.getInvokeGroups().containsKey(INVOKE_GROUP.getId()))
Resource.conf.getInvokeGroups().put(INVOKE_GROUP.getId(), INVOKE_GROUP);
};

public static void load() {
Resource.loadConfAfter.add(runnable);

Methods.invokes.put("pointKugou", pointKugou);
Methods.invokes.put("pointQQ", pointQQ);
Methods.invokes.put("pointWy", pointWy);
Methods.invokes.put("pointKugou", POINT_KUGOU);
Methods.invokes.put("pointQQ", POINT_QQ);
Methods.invokes.put("pointWy", POINT_WY);

Resource.i1();
}

public static JSONObject getSong(String keyword, String type) {
String urlStr = String.format(baseUrl, keyword, type);
String urlStr = String.format(BASE_URL, keyword, type);
String jsonStr = UrlUtils.getStringFromHttpUrl(urlStr);
return JSON.parseObject(jsonStr).getJSONArray("data").getJSONObject(0);
}
Expand Down
16 changes: 6 additions & 10 deletions Lsys-GetSong/src/main/java/cn/kloping/lsys/getSong/PluginMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,22 @@
import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescriptionBuilder;
import org.jetbrains.annotations.NotNull;

/**
* @author github-kloping
*/
public class PluginMain extends JavaPlugin {
public static final PluginMain INSTANCE = new PluginMain();

private PluginMain() {
super(new JvmPluginDescriptionBuilder("cn.kloping.lsys.getSong.PluginMain", "0.2")
super(new JvmPluginDescriptionBuilder("cn.kloping.lsys.getSong.PluginMain", "1.0")
.name("plugin_5 Author - HRS LSys GetSong Loaded")
.info("plugin-song")
.author("HRS").dependsOn("cn.kloping.Lsys", "0.3", true)
.author("HRS").dependsOn("cn.kloping.Lsys", "1.0", true)
.build());
}

@Override
public void onLoad(@NotNull PluginComponentStorage $this$onLoad) {
if (!Utils.isExits()) {
getLogger().error("欲使用GetSong插件 必须安装 Lsys 插件");
getLogger().error("欲使用GetSong插件 必须安装 Lsys 插件");
getLogger().error("欲使用GetSong插件 必须安装 Lsys 插件");
PluginManager.INSTANCE.disablePlugin(INSTANCE);
return;
}
public void onLoad(@NotNull PluginComponentStorage load) {
Loader.load();
}

Expand Down
19 changes: 0 additions & 19 deletions Lsys-GetSong/src/main/java/cn/kloping/lsys/getSong/Utils.java

This file was deleted.

Loading

0 comments on commit a3975c8

Please sign in to comment.