This commit is contained in:
GregTCLTK 2020-01-21 07:46:55 +01:00
parent 9b6f48e58c
commit e1b2ccf3d5
No known key found for this signature in database
GPG key ID: A91BADE5C070FF67

View file

@ -7,11 +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 java.io.IOException;
public class TransCommand implements Command { public class TransCommand implements Command {
@ -19,22 +15,13 @@ public class TransCommand 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://nekos.life/api/v2/img/trap/");
Request request = new Request.Builder().url("https://nekos.life/api/v2/img/trap").build();
try {
Response response = caller.newCall(request).execute();
String url = response.body().string().replace("{\"url\":\"", "");
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO) e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), .setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
url.replace("\"}", "")) .setImage(url)
.setImage(url.replace("\"}", "")).setFooter("Trans").build()).queue(); .setFooter("Trans")
.build()).queue();
} catch (IOException ex) {
ex.printStackTrace();
}
} else { } else {
e.getTextChannel() e.getTextChannel()