Skip to content

Commit

Permalink
feat(order): update new order to control bot
Browse files Browse the repository at this point in the history
  • Loading branch information
aowubulao committed Jan 7, 2021
1 parent f8a5a99 commit fec7c85
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 17 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

2)下载后放入plugins文件夹

3)启动mirai-console,启动后请等待插件加载数据
3)启动mirai-console,启动后请等待插件加载数据,时间大概在20s-70s

4)指令:

- **\#物品掉率 扭转醇**
- **\#地图掉率 1-7**
- **物品查询#扭转醇**
- **地图查询#1-7**
- 好友消息:**\#刷新掉率数据**

16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.neoniou.bot</groupId>
<artifactId>arknights-drop-plugin</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand Down Expand Up @@ -41,8 +41,18 @@
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.5.4</version>
<artifactId>hutool-core</artifactId>
<version>5.5.6</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-json</artifactId>
<version>5.5.6</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>5.5.6</version>
</dependency>
</dependencies>

Expand Down
12 changes: 8 additions & 4 deletions src/main/java/com/neoniou/bot/constant/PenguinApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
*/
public interface PenguinApi {

String GET_ITEMS = "https://penguin-stats.cn/PenguinStats/api/v2/items/";
String IO_BASE = "https://penguin-stats.io";

String GET_MATRIX = "https://penguin-stats.cn/PenguinStats/api/v2/result/matrix?is_personal=false&server=CN&show_closed_zones=false";
String CN_BASE = "https://penguin-stats.cn";

String GET_MATRIX_CLOSED = "https://penguin-stats.cn/PenguinStats/api/v2/result/matrix?is_personal=false&server=CN&show_closed_zones=true";
String GET_ITEMS = IO_BASE + "/PenguinStats/api/v2/items/";

String GET_STAGES = "https://penguin-stats.cn/PenguinStats/api/v2/stages?server=CN";
String GET_MATRIX = IO_BASE + "/PenguinStats/api/v2/result/matrix?is_personal=false&server=CN&show_closed_zones=false";

String GET_MATRIX_CLOSED = IO_BASE + "/PenguinStats/api/v2/result/matrix?is_personal=false&server=CN&show_closed_zones=true";

String GET_STAGES = IO_BASE + "/PenguinStats/api/v2/stages?server=CN";

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
*/
public class ItemDropHandler extends MessageHandler {

private static final String STR = "#物品掉率 ";
private static final String STR = "\\u7269\\u54c1\\u67e5\\u8be2\\u0023.+?";

private static final int MATCHING = 3;
private static final int MATCHING = 1;

private static final int MAX_SHOW = 3;

private static final String ENDLESS = "∞";

private static final String SHARP = "#";

@Override
public void handleGroupMessage(GroupMessageEvent event) {
String messageBody = getMessageBody(event);
Expand All @@ -36,7 +38,7 @@ public void handleGroupMessage(GroupMessageEvent event) {
return;
}

String itemName = messageBody.substring(messageBody.lastIndexOf(" ") + 1);
String itemName = messageBody.substring(messageBody.lastIndexOf(SHARP) + 1);
if (ItemStatus.nameKeyMap.containsKey(itemName)) {
getDropAndSend(ItemStatus.nameKeyMap.get(itemName), event);
} else if (ItemStatus.aliasMap.containsKey(itemName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RefreshDataHandler extends MessageHandler {

private static final String STR = "#刷新掉率数据";

private static final int MATCHING = 3;
private static final int MATCHING = 2;

@Override
public void handleGroupMessage(GroupMessageEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
*/
public class StageDropHandler extends MessageHandler {

private static final String STR = "#地图掉率 ";
private static final String STR = "\\u5730\\u56fe\\u67e5\\u8be2\\u0023.+?";

private static final int MATCHING = 3;
private static final int MATCHING = 1;

private static final String SHARP = "#";

@Override
public void handleGroupMessage(GroupMessageEvent event) {
Expand All @@ -33,7 +35,7 @@ public void handleGroupMessage(GroupMessageEvent event) {
return;
}

String code = messageBody.substring(messageBody.lastIndexOf(" ") + 1).toUpperCase(Locale.ROOT);
String code = messageBody.substring(messageBody.lastIndexOf(SHARP) + 1).toUpperCase(Locale.ROOT);
Stage stage = StageStatus.codeKeyMap.get(code);
if (stage == null) {
event.getGroup().sendMessage("没有该地图!");
Expand Down

0 comments on commit fec7c85

Please sign in to comment.