This commit is contained in:
GregTCLTK 2020-01-20 19:22:04 +01:00
parent e332f77432
commit 68e676d04e
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67

View file

@ -7,12 +7,7 @@ package com.bbn.hadder.commands.nsfw;
import com.bbn.hadder.commands.Command; import com.bbn.hadder.commands.Command;
import com.bbn.hadder.commands.CommandEvent; import com.bbn.hadder.commands.CommandEvent;
import com.bbn.hadder.utils.MessageEditor; import com.bbn.hadder.utils.MessageEditor;
import okhttp3.OkHttpClient; import com.bbn.hadder.utils.Request;
import okhttp3.Request;
import okhttp3.Response;
import org.json.JSONObject;
import java.io.IOException;
public class CumCommand implements Command { public class CumCommand implements Command {
@ -20,26 +15,13 @@ public class CumCommand implements Command {
public void executed(String[] args, CommandEvent e) { public void executed(String[] args, CommandEvent e) {
if (e.getTextChannel().isNSFW()) { if (e.getTextChannel().isNSFW()) {
OkHttpClient caller = new OkHttpClient(); String url = Request.get("https://api.nekos.dev/api/v3/images/nsfw/gif/cum/");
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/cum/").build();
try { e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
Response response = caller.newCall(request).execute(); .setImage(url.replace("\"}", ""))
JSONObject json = new JSONObject(response.body().string()); .setFooter("Cum")
JSONObject data = json.getJSONObject("data"); .build()).queue();
JSONObject response1 = data.getJSONObject("response");
String url = response1.toString().replace("{\"url\":\"", "");
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url.replace("\"}", ""))
.setImage(url.replace("\"}", ""))
.setFooter("Cum")
.build()).queue();
} catch (IOException ex) {
ex.printStackTrace();
}
} else { } else {
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue(); e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.NO_NSFW).build()).queue();