新增错误提示

This commit is contained in:
Yutousama 2022-04-17 02:03:46 +08:00
parent e0e7195c57
commit 490ae1b9dc

View File

@ -42,6 +42,10 @@ public class GetSeTu extends Model {
} }
String ret = HttpTools.get(url); String ret = HttpTools.get(url);
JSONObject json = JSONObject.parseObject(ret); 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"), HttpTools.download(json.getJSONArray("data").getJSONObject(0).getJSONObject("urls").getString("original"),
System.currentTimeMillis()+"_setu.jpg", System.currentTimeMillis()+"_setu.jpg",
true true
@ -55,7 +59,7 @@ public class GetSeTu extends Model {
@Override @Override
public void onError(Exception e) { public void onError(Exception e) {
super.onError(e); super.onError(e);
QQBotManager.getInstance().sendMessage(qq,"获取失败"); QQBotManager.getInstance().sendMessage(qq,"获取失败喵~");
} }
}); });
} }