2022-01-01 23:36:12 +08:00
|
|
|
package com.yutou.qqbot.models.setu;
|
|
|
|
|
2022-01-02 00:14:27 +08:00
|
|
|
import com.alibaba.fastjson.JSONObject;
|
2022-01-01 23:36:12 +08:00
|
|
|
import com.yutou.qqbot.QQBotManager;
|
|
|
|
import com.yutou.qqbot.interfaces.DownloadInterface;
|
|
|
|
import com.yutou.qqbot.models.Model;
|
|
|
|
import com.yutou.qqbot.utlis.HttpTools;
|
|
|
|
import net.mamoe.mirai.event.events.MessageEvent;
|
|
|
|
import net.mamoe.mirai.message.data.MessageChainBuilder;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
public class GetSeTu extends Model {
|
|
|
|
@Override
|
|
|
|
public boolean isUserPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String[] getUsePowers() {
|
|
|
|
return new String[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
|
|
|
|
super.onMessage(qq, event, isGroup);
|
|
|
|
if ("来点色图".equals(msg)||"来点涩图".equals(msg)){
|
2022-01-02 00:14:27 +08:00
|
|
|
String ret=HttpTools.get("https://api.ixiaowai.cn/api/api.php?return=json");
|
|
|
|
System.out.println("ret = " + ret);
|
|
|
|
JSONObject json=JSONObject.parseObject(ret);
|
|
|
|
HttpTools.download(json.getString("acgurl"),
|
2022-01-01 23:36:12 +08:00
|
|
|
null, new DownloadInterface() {
|
|
|
|
@Override
|
|
|
|
public void onDownload(File file) {
|
|
|
|
super.onDownload(file);
|
|
|
|
QQBotManager.getInstance().sendMessage(file,qq,"");
|
|
|
|
file.deleteOnExit();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2022-01-02 00:14:27 +08:00
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
HttpTools.download("https://api.ixiaowai.cn/api/api.php", null, new DownloadInterface() {
|
|
|
|
@Override
|
|
|
|
public void onDownload(File file) {
|
|
|
|
super.onDownload(file);
|
|
|
|
System.out.println(file.getAbsoluteFile());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onError(Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2022-01-01 23:36:12 +08:00
|
|
|
}
|