remove debug code
This commit is contained in:
parent
308f29bf74
commit
f8f247f556
Binary file not shown.
|
@ -1,80 +1,77 @@
|
||||||
package be.xrg.evilbotx.components;
|
package be.xrg.evilbotx.components;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.pircbotx.hooks.Event;
|
import org.pircbotx.hooks.Event;
|
||||||
import org.pircbotx.hooks.events.MessageEvent;
|
import org.pircbotx.hooks.events.MessageEvent;
|
||||||
|
|
||||||
import be.xrg.evilbotx.Storage;
|
import be.xrg.evilbotx.Storage;
|
||||||
import be.xrg.evilbotx.Utilities;
|
import be.xrg.evilbotx.Utilities;
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public class UrbanCommand extends be.xrg.evilbotx.parents.EBXComponent {
|
public class UrbanCommand extends be.xrg.evilbotx.parents.EBXComponent {
|
||||||
|
|
||||||
public UrbanCommand(Storage s) {
|
public UrbanCommand(Storage s) {
|
||||||
super(s, MessageEvent.class);
|
super(s, MessageEvent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleEvent(Event e) {
|
public void handleEvent(Event e) {
|
||||||
MessageEvent t = (MessageEvent) e;
|
MessageEvent t = (MessageEvent) e;
|
||||||
String b = t.getMessage();
|
String b = t.getMessage();
|
||||||
boolean response = false;
|
boolean response = false;
|
||||||
if (b.startsWith("!urban")) {
|
if (b.startsWith("!urban")) {
|
||||||
if (b.contains(" ")) {
|
if (b.contains(" ")) {
|
||||||
String[] c = b.split(" ", 2);
|
String[] c = b.split(" ", 2);
|
||||||
System.out.println(c[0]);
|
JSONObject d = new JSONObject(
|
||||||
System.out.println(c[1]);
|
Utilities
|
||||||
String a = Utilities
|
.getHTMLPage("http://api.urbandictionary.com/v0/define?term="
|
||||||
.getHTMLPage("http://api.urbandictionary.com/v0/define?term="
|
+ Utilities.urlEncode(c[1]))[1]);
|
||||||
+ Utilities.urlEncode(c[1]))[1];
|
if (d.has("result_type")) {
|
||||||
System.out.println(a);
|
Object g = d.get("result_type");
|
||||||
JSONObject d = new JSONObject(a);
|
if (g instanceof String) {
|
||||||
if (d.has("result_type")) {
|
if (((String) g).equals("exact")) {
|
||||||
Object g = d.get("result_type");
|
if (d.has("list")) {
|
||||||
if (g instanceof String) {
|
JSONArray h = d.getJSONArray("list");
|
||||||
if (((String) g).equals("exact")) {
|
d = h.getJSONObject(0);
|
||||||
if (d.has("list")) {
|
if (d.has("word") && d.has("definition")) {
|
||||||
JSONArray h = d.getJSONArray("list");
|
Object i = d.get("word"), j = d
|
||||||
d = h.getJSONObject(0);
|
.get("definition");
|
||||||
if (d.has("word") && d.has("definition")) {
|
if ((i instanceof String)
|
||||||
Object i = d.get("word"), j = d
|
&& (j instanceof String)) {
|
||||||
.get("definition");
|
t.getBot().sendMessage(
|
||||||
if ((i instanceof String)
|
t.getChannel(),
|
||||||
&& (j instanceof String)) {
|
((String) i) + ": "
|
||||||
t.getBot().sendMessage(
|
+ ((String) j));
|
||||||
t.getChannel(),
|
response = true;
|
||||||
((String) i) + ": "
|
}
|
||||||
+ ((String) j));
|
}
|
||||||
response = true;
|
}
|
||||||
}
|
} else {
|
||||||
}
|
t.respond("Unable to find exact match.");
|
||||||
}
|
response = true;
|
||||||
} else {
|
}
|
||||||
t.respond("Unable to find exact match.");
|
}
|
||||||
response = true;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!response) {
|
||||||
}
|
t.respond("Unable to perform lookup.");
|
||||||
}
|
}
|
||||||
if (!response) {
|
}
|
||||||
t.respond("Unable to perform lookup.");
|
|
||||||
}
|
protected boolean wantEventM(Event e) {
|
||||||
}
|
if (e instanceof MessageEvent) {
|
||||||
|
return ((MessageEvent) e).getMessage().startsWith("!urban");
|
||||||
protected boolean wantEventM(Event e) {
|
}
|
||||||
if (e instanceof MessageEvent) {
|
return false;
|
||||||
return ((MessageEvent) e).getMessage().startsWith("!urban");
|
}
|
||||||
}
|
|
||||||
return false;
|
public String getComponentName() {
|
||||||
}
|
return "UrbanCommand";
|
||||||
|
}
|
||||||
public String getComponentName() {
|
|
||||||
return "UrbanCommand";
|
public int getComponentID() {
|
||||||
}
|
return 4823303;
|
||||||
|
}
|
||||||
public int getComponentID() {
|
|
||||||
return 4823303;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Reference in a new issue