Merge remote-tracking branch 'origin/master'

This commit is contained in:
Matthew Cech
2020-02-25 21:12:01 -08:00
3 changed files with 12 additions and 11 deletions
+2 -7
View File
@@ -24,13 +24,8 @@ public class CommandE6 extends Command
@Override @Override
public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) public void onRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
{ {
if(guild.contentRating == KittyRating.Filtered || !guild.channels.get(Long.getLong(channel.uniqueID)).mature) if(guild.contentRating == KittyRating.Filtered)
{ {
if(!guild.channels.get(Long.getLong(channel.uniqueID)).mature)
{
res.send("This channel is SFW only! Have some (probably) wholesome content ^^~");
}
image = searcher.getE6(input.args + " rating:safe"); image = searcher.getE6(input.args + " rating:safe");
try try
{ {
@@ -43,7 +38,7 @@ public class CommandE6 extends Command
} }
try try
{ {
if(response.authorText == null) if(response.bodyImageURL == null)
{ {
Exception e = new Exception(); Exception e = new Exception();
throw e; throw e;
+6 -1
View File
@@ -77,17 +77,22 @@ public class NetworkE6
} }
else else
{ {
for(int i = 0; i < imageObj.length; ++i) for(int i = 0; i < imageObj.length; ++i)
{ {
String [] TagsList = imageObj[i].tags.split(" ");
blacklisted = false; blacklisted = false;
for(int j = 0; j < blacklist.length; j++) for(int j = 0; j < blacklist.length; j++)
{ {
if(imageObj[i].tags.contains(blacklist[j])) for(int k = 0; k < TagsList.length; k ++)
{
if(TagsList[k].equals(blacklist[j]))
{ {
System.out.println("BLACKLISTED " + blacklist[j]); System.out.println("BLACKLISTED " + blacklist[j]);
blacklisted = true; blacklisted = true;
} }
} }
}
if(blacklisted) if(blacklisted)
{ {
+2 -1
View File
@@ -10,7 +10,7 @@ import utils.HTTPUtils;
public class NetworkSauceNAO public class NetworkSauceNAO
{ {
private static final Gson jsonParser_ = new Gson(); private static final Gson jsonParser_ = new Gson();
private static final String API_ROOT = "https://saucenao.com/search.php?db=999&output_type=2&numres=10&api_key=" + Ref.SauceNAOKey +"&url="; private static final String API_ROOT = "https://saucenao.com/search.php?dbmask=268435456&output_type=2&numres=10&api_key=" + Ref.SauceNAOKey +"&url=";
NetworkE6 e6Sauce = new NetworkE6(); NetworkE6 e6Sauce = new NetworkE6();
private class SauceNAOResponseObject private class SauceNAOResponseObject
{ {
@@ -40,6 +40,7 @@ public class NetworkSauceNAO
if(sauceUrl.startsWith("https://e621.net/post/show/")) if(sauceUrl.startsWith("https://e621.net/post/show/"))
{ {
System.out.println("id:" + sauceUrl.substring(26)); System.out.println("id:" + sauceUrl.substring(26));
System.out.println("HERE");
return e6Sauce.getE6("id:" + sauceUrl.substring(27)).toString(); return e6Sauce.getE6("id:" + sauceUrl.substring(27)).toString();
} }
return sauce.results.get(0).data.ext_urls[0]; return sauce.results.get(0).data.ext_urls[0];