修复QQ发图片会资源泄露的问题

This commit is contained in:
2022-01-02 00:59:22 +08:00
parent 6a68e95f45
commit 6e4fc0c3d3
2 changed files with 29 additions and 2 deletions

View File

@@ -38,4 +38,22 @@ public class GetSeTu extends Model {
}
}
public static void main(String[] args) {
QQBotManager.getInstance();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
String ret = HttpTools.get("https://api.ixiaowai.cn/api/api.php?return=json");
JSONObject json = JSONObject.parseObject(ret);
HttpTools.download(json.getString("imgurl"),
"setu.jpg", new DownloadInterface() {
@Override
public void onDownload(File file) {
super.onDownload(file);
QQBotManager.getInstance().sendMessage(file, 583819556L, "");
}
});
}
}