42 lines
1.3 KiB
Java
Raw Normal View History

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);
2022-01-02 00:40:09 +08:00
if ("来点色图".equals(msg) || "来点涩图".equals(msg)) {
String ret = HttpTools.get("https://api.ixiaowai.cn/api/api.php?return=json");
JSONObject json = JSONObject.parseObject(ret);
2022-01-02 00:16:36 +08:00
HttpTools.download(json.getString("imgurl"),
2022-01-02 00:18:48 +08:00
"setu.jpg", new DownloadInterface() {
2022-01-01 23:36:12 +08:00
@Override
public void onDownload(File file) {
super.onDownload(file);
2022-01-02 00:40:09 +08:00
QQBotManager.getInstance().sendMessage(file, qq, "");
2022-01-01 23:36:12 +08:00
}
});
}
}
2022-01-02 00:14:27 +08:00
2022-01-01 23:36:12 +08:00
}