From 490ae1b9dcb20b388d8d3934beed4d5996591d4a Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Sun, 17 Apr 2022 02:03:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=94=99=E8=AF=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java b/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java index 233d281..e48441b 100644 --- a/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java +++ b/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java @@ -42,6 +42,10 @@ public class GetSeTu extends Model { } String ret = HttpTools.get(url); JSONObject json = JSONObject.parseObject(ret); + if(json.getJSONArray("data").size()==0){ + QQBotManager.getInstance().sendMessage(qq,"找不到喵~"); + return; + } HttpTools.download(json.getJSONArray("data").getJSONObject(0).getJSONObject("urls").getString("original"), System.currentTimeMillis()+"_setu.jpg", true @@ -55,7 +59,7 @@ public class GetSeTu extends Model { @Override public void onError(Exception e) { super.onError(e); - QQBotManager.getInstance().sendMessage(qq,"获取失败"); + QQBotManager.getInstance().sendMessage(qq,"获取失败喵~"); } }); }