Skip to content
This repository has been archived by the owner on Apr 18, 2021. It is now read-only.

Commit

Permalink
add AutoRecall
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Jan 9, 2021
1 parent 4e4212e commit 3eca9a0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ apikey: '' //填写apikey
r18: false //是否开启r18
r18-groups: //允许r18的群
- 1145141919810
limit-mode: false //限速模式,一分钟仅允许使用15次
FlashImageMode: true //闪照模式,发送图片为闪照
AutoRecall: 0 //自动撤回时间,0为禁用
```

# Download
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/shrbox/github/acgpro/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Main extends PluginBase {
public static boolean isPulling = false;
short count = 0;
public static boolean flashImageMode;
public static int autoRecall;

public void load_Config() { //配置文件加载
config = loadConfig("config.yml");
Expand All @@ -27,9 +28,11 @@ public void load_Config() { //配置文件加载
config.setIfAbsent("r18-groups", r18Groups);
config.setIfAbsent("limit-mode", false);
config.setIfAbsent("FlashImageMode", false);
config.setIfAbsent("AutoRecall", 0);
config.save();
r18Groups.clear();
flashImageMode = config.getBoolean("FlashImageMode");
autoRecall = config.getInt("AutoRecall");
}
public void onEnable() {
load_Config();
Expand Down
22 changes: 14 additions & 8 deletions src/main/java/shrbox/github/acgpro/Thread.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,19 @@ public void run() {
+ "\n作者名: " + data.author
+ "\n作者UID: " + data.uid
+ "\n原图: " + imageURL);
MessageReceipt<Contact> msg;
if (Main.flashImageMode) {
MessageReceipt<Contact> msg = e.getGroup().sendMessage(FlashImage.from(image));
msg = e.getGroup().sendMessage(FlashImage.from(image));
} else {
msg = e.getGroup().sendMessage(image);
}
if (Main.autoRecall != 0) {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
msg.recall();
}
}, 20 * 1000);
} else {
e.getGroup().sendMessage(image);
}, Main.autoRecall * 1000);
}
} else {
if (pigNum > json.data.size()) pigNum = (short) json.data.size();
Expand Down Expand Up @@ -139,16 +142,19 @@ public void run() {
+ "\n作者UID: " + data.uid
+ "\n原图: " + imageURL
+ "\n[" + (a + 1) + "/" + pigNum + "]");
MessageReceipt<Contact> msg;
if (Main.flashImageMode) {
MessageReceipt<Contact> msg = e.getGroup().sendMessage(FlashImage.from(image));
msg = e.getGroup().sendMessage(FlashImage.from(image));
} else {
msg = e.getGroup().sendMessage(image);
}
if (Main.autoRecall != 0) {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
msg.recall();
}
}, 20 * 1000);
} else {
e.getGroup().sendMessage(image);
}, Main.autoRecall * 1000);
}
}
}
Expand Down

0 comments on commit 3eca9a0

Please sign in to comment.