Spank
This commit is contained in:
parent
6ddd228b5d
commit
9b6f48e58c
1 changed files with 7 additions and 24 deletions
|
|
@ -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 SpankCommand implements Command {
|
public class SpankCommand implements Command {
|
||||||
|
|
||||||
|
|
@ -20,25 +15,13 @@ public class SpankCommand 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/spank/");
|
||||||
Request request = new Request.Builder().url("https://api.nekos.dev/api/v3/images/nsfw/gif/spank/").build();
|
|
||||||
|
|
||||||
try {
|
e.getTextChannel().sendMessage(e.getMessageEditor().getMessage(MessageEditor.MessageType.INFO)
|
||||||
|
.setAuthor(e.getMessageEditor().getTerm("commands.nsfw.gif.error.title"), url)
|
||||||
Response response = caller.newCall(request).execute();
|
.setImage(url)
|
||||||
JSONObject json = new JSONObject(response.body().string());
|
.setFooter("Spank")
|
||||||
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("Spank").build()).queue();
|
|
||||||
|
|
||||||
} catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
e.getTextChannel()
|
e.getTextChannel()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue