remove debug code

This commit is contained in:
Kegan Myers 2013-06-30 19:08:15 -05:00
parent 308f29bf74
commit f8f247f556
2 changed files with 77 additions and 80 deletions

Binary file not shown.

View file

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