Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -27,5 +27,6 @@
|
|||||||
<classpathentry kind="lib" path="lib/google-http-client-1.32.0.jar"/>
|
<classpathentry kind="lib" path="lib/google-http-client-1.32.0.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/google-api-services-youtube-v3-rev212-1.25.0.jar"/>
|
<classpathentry kind="lib" path="lib/google-api-services-youtube-v3-rev212-1.25.0.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/LavaPlayerJar-0.0.1-jar-with-dependencies.jar"/>
|
<classpathentry kind="lib" path="lib/LavaPlayerJar-0.0.1-jar-with-dependencies.jar"/>
|
||||||
|
<classpathentry kind="lib" path="lib/nanohttpd-2.3.1.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
+5
-1
@@ -116,7 +116,7 @@
|
|||||||
"Localized Strings","DerpiError",""
|
"Localized Strings","DerpiError",""
|
||||||
"Localized Strings","DoWorkFinished","I finished with my work! :D"
|
"Localized Strings","DoWorkFinished","I finished with my work! :D"
|
||||||
"Localized Strings","DoWorkInfo","Occupies a core for a few seconds"
|
"Localized Strings","DoWorkInfo","Occupies a core for a few seconds"
|
||||||
"Localized Strings","E6Blacklisted",""
|
"Localized Strings","E6Blacklisted","I can't show that image ;3; (it may be blacklisted)"
|
||||||
"Localized Strings","EightBallError","Hmm? You'll need to ask a question!"
|
"Localized Strings","EightBallError","Hmm? You'll need to ask a question!"
|
||||||
"Localized Strings","EightBallInfo","Answers a yes or no question! Warning: Kitty can not actually tell the future, she claims no responsibility for any lion mauling, lack of lottery wins, or felony charges."
|
"Localized Strings","EightBallInfo","Answers a yes or no question! Warning: Kitty can not actually tell the future, she claims no responsibility for any lion mauling, lack of lottery wins, or felony charges."
|
||||||
"Localized Strings","EightBallMaybe1","Reply hazy, try again."
|
"Localized Strings","EightBallMaybe1","Reply hazy, try again."
|
||||||
@@ -187,7 +187,11 @@
|
|||||||
"Localized Strings","MapVersion","Using mapgen v0.1"
|
"Localized Strings","MapVersion","Using mapgen v0.1"
|
||||||
"Localized Strings","MapWidth",""
|
"Localized Strings","MapWidth",""
|
||||||
"Localized Strings","ModInfo","Mod is a super command for admin or mod use only!\n\t`mod ban @user` will ban a user from the server\n\t`mod kick @user` will kick the user from the server"
|
"Localized Strings","ModInfo","Mod is a super command for admin or mod use only!\n\t`mod ban @user` will ban a user from the server\n\t`mod kick @user` will kick the user from the server"
|
||||||
|
"Localized Strings","MusicAddTrack",""
|
||||||
"Localized Strings","MusicInfo",""
|
"Localized Strings","MusicInfo",""
|
||||||
|
"Localized Strings","MusicVolChanged","Volume set to %s!"
|
||||||
|
"Localized Strings","MusicVolCurrent","Volume is at %s!"
|
||||||
|
"Localized Strings","MusicVolOOB",""
|
||||||
"Localized Strings","PerishInfo","Adds a red, 'a n g e r y' overlay to your icon or the icon of a friend you mentioned"
|
"Localized Strings","PerishInfo","Adds a red, 'a n g e r y' overlay to your icon or the icon of a friend you mentioned"
|
||||||
"Localized Strings","PingInfo","Will respond with Pong!"
|
"Localized Strings","PingInfo","Will respond with Pong!"
|
||||||
"Localized Strings","PingResponse","Pong!"
|
"Localized Strings","PingResponse","Pong!"
|
||||||
|
|||||||
|
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
@@ -1,8 +1,23 @@
|
|||||||
package commands.general;
|
package commands.general;
|
||||||
|
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import core.Command;
|
import core.Command;
|
||||||
|
import core.Constants;
|
||||||
import core.LocStrings;
|
import core.LocStrings;
|
||||||
import dataStructures.*;
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.Response;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
public class CommandBeansShow extends Command
|
public class CommandBeansShow extends Command
|
||||||
{
|
{
|
||||||
@@ -15,7 +30,15 @@ public class CommandBeansShow extends Command
|
|||||||
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(input.mentions == null)
|
if(input.mentions == null)
|
||||||
res.send(String.format(LocStrings.stub("BeansShowDisplay"), user.getBeans()));
|
{
|
||||||
|
res.send("" + user.getBeans());
|
||||||
|
try {
|
||||||
|
res.sendFile(combineImages(user.getBeans()), "png");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
// res.send(String.format(LocStrings.stub("BeansShowDisplay"), user.getBeans()));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String mentionedBeans = "";
|
String mentionedBeans = "";
|
||||||
@@ -26,4 +49,75 @@ public class CommandBeansShow extends Command
|
|||||||
res.send(String.format(LocStrings.stub("BeansShowMentioned"), mentionedBeans));
|
res.send(String.format(LocStrings.stub("BeansShowMentioned"), mentionedBeans));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private File combineImages(long beans) throws IOException
|
||||||
|
{
|
||||||
|
// Acquire images
|
||||||
|
BufferedImage imageBase = ImageIO.read(new File(Constants.AssetDirectory + "beans/BeansBG.png"));
|
||||||
|
BufferedImage thouBean = ImageIO.read(new File(Constants.AssetDirectory + "beans/thouBean.png"));
|
||||||
|
BufferedImage hunBean = ImageIO.read(new File(Constants.AssetDirectory + "beans/hunBean.png"));
|
||||||
|
BufferedImage tenBean = ImageIO.read(new File(Constants.AssetDirectory + "beans/tenBean.png"));
|
||||||
|
BufferedImage oneBean = ImageIO.read(new File(Constants.AssetDirectory + "beans/oneBean.png"));
|
||||||
|
|
||||||
|
final int baseWidth = imageBase.getWidth();
|
||||||
|
final int baseHeight = imageBase.getHeight();
|
||||||
|
|
||||||
|
long calcBean = beans;
|
||||||
|
|
||||||
|
System.out.println("BEANS: " + beans);
|
||||||
|
|
||||||
|
long thousands = beans / 1000;
|
||||||
|
calcBean = beans % 1000;
|
||||||
|
long hundreds = (calcBean / 100);
|
||||||
|
calcBean = calcBean % 100;
|
||||||
|
long tens = (calcBean / 10);
|
||||||
|
calcBean = calcBean % 10;
|
||||||
|
long ones = calcBean;
|
||||||
|
|
||||||
|
BufferedImage beanImage = new BufferedImage(baseWidth, baseHeight, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics beanGraphics = beanImage.getGraphics();
|
||||||
|
|
||||||
|
for(int i = 0; i < ones; i++)
|
||||||
|
{
|
||||||
|
int x = (int)(Math.random() * (baseWidth - oneBean.getWidth())) + 1;
|
||||||
|
int y = (int)(Math.random() * (baseHeight - oneBean.getHeight())) + 1;
|
||||||
|
beanGraphics.drawImage(oneBean, x, y, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < tens; i++)
|
||||||
|
{
|
||||||
|
int x = (int)(Math.random() * (baseWidth - tenBean.getWidth())) + 1;
|
||||||
|
int y = (int)(Math.random() * (baseHeight - tenBean.getHeight())) + 1;
|
||||||
|
beanGraphics.drawImage(tenBean, x, y, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < hundreds; i++)
|
||||||
|
{
|
||||||
|
int x = (int)(Math.random() * (baseWidth - hunBean.getWidth())) + 1;
|
||||||
|
int y = (int)(Math.random() * (baseHeight - hunBean.getHeight())) + 1;
|
||||||
|
beanGraphics.drawImage(hunBean, x, y, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < thousands; i++)
|
||||||
|
{
|
||||||
|
int x = (int)(Math.random() * (baseWidth - thouBean.getWidth())) + 1;
|
||||||
|
int y = (int)(Math.random() * (baseHeight - thouBean.getHeight())) + 1;
|
||||||
|
beanGraphics.drawImage(thouBean, x, y, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
Font font = null;
|
||||||
|
font = Font.createFont(Font.TRUETYPE_FONT, new File(Constants.AssetDirectory +"fonts/B612Mono-Regular.ttf"));
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Font beanFont = new Font("font", Font.BOLD, 45);
|
||||||
|
beanGraphics.setFont(beanFont);
|
||||||
|
beanGraphics.drawString("YOU GOT " + beans + " BEANS", 0, baseHeight / 2);
|
||||||
|
|
||||||
|
ImageIO.write(beanImage, "PNG", new File("beanImage.png"));
|
||||||
|
return new File("beanImage.png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class CommandColor extends Command
|
|||||||
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)
|
||||||
{
|
{
|
||||||
// First, try and parse out the color to make sure we can even get it.
|
// First, try and parse out the color to make sure we can even get it.
|
||||||
ColorData colorData = theColorAPI.lookupHex(input.args.trim());
|
ColorData colorData = theColorAPI.lookupHex(input.args);
|
||||||
|
|
||||||
// Verify the color was even found
|
// Verify the color was even found
|
||||||
if(colorData == null)
|
if(colorData == null)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public class CommandE6 extends Command
|
|||||||
{
|
{
|
||||||
NetworkE6 searcher = new NetworkE6();
|
NetworkE6 searcher = new NetworkE6();
|
||||||
KittyEmbed response;
|
KittyEmbed response;
|
||||||
|
GenericImage image;
|
||||||
|
|
||||||
public CommandE6(KittyRole level, KittyRating rating) { super(level, rating); }
|
public CommandE6(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
|
||||||
@@ -23,15 +24,25 @@ 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)
|
image = searcher.getE6(input.args + " rating:safe");
|
||||||
{
|
|
||||||
res.send("This channel is SFW only! Have some (probably) wholesome content ^^~");
|
|
||||||
}
|
|
||||||
response = searcher.getE6(input.args + " rating:safe").output();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
response = image.output();
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
res.send(LocStrings.stub("E6Blacklisted"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(response.bodyImageURL == null)
|
||||||
|
{
|
||||||
|
Exception e = new Exception();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
res.send(response);
|
res.send(response);
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class CommandMusicMain extends Command
|
|||||||
framework.addCommand("skip", new SubCommandSkip(KittyRole.General, KittyRating.Safe));
|
framework.addCommand("skip", new SubCommandSkip(KittyRole.General, KittyRating.Safe));
|
||||||
framework.addCommand("stop", new SubCommandStop(KittyRole.General, KittyRating.Safe));
|
framework.addCommand("stop", new SubCommandStop(KittyRole.General, KittyRating.Safe));
|
||||||
framework.addCommand("playlist", new SubCommandPlaylist(KittyRole.General, KittyRating.Safe));
|
framework.addCommand("playlist", new SubCommandPlaylist(KittyRole.General, KittyRating.Safe));
|
||||||
|
framework.addCommand("volume", new SubCommandVolume(KittyRole.General, KittyRating.Safe));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package commands.music;
|
package commands.music;
|
||||||
|
|
||||||
|
import core.LocStrings;
|
||||||
import core.SubCommand;
|
import core.SubCommand;
|
||||||
import core.SubCommandFormattable;
|
import core.SubCommandFormattable;
|
||||||
import dataStructures.KittyChannel;
|
import dataStructures.KittyChannel;
|
||||||
@@ -27,6 +28,6 @@ public class SubCommandAddTrack extends SubCommand
|
|||||||
video = YT.getYT(video);
|
video = YT.getYT(video);
|
||||||
}
|
}
|
||||||
guild.audio.playVideo(video);
|
guild.audio.playVideo(video);
|
||||||
return new SubCommandFormattable(video);
|
return new SubCommandFormattable(String.format(LocStrings.stub("MusicAddTrack"), video));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package commands.music;
|
||||||
|
|
||||||
|
import core.LocStrings;
|
||||||
|
import core.SubCommand;
|
||||||
|
import core.SubCommandFormattable;
|
||||||
|
import dataStructures.KittyChannel;
|
||||||
|
import dataStructures.KittyGuild;
|
||||||
|
import dataStructures.KittyRating;
|
||||||
|
import dataStructures.KittyRole;
|
||||||
|
import dataStructures.KittyUser;
|
||||||
|
import dataStructures.UserInput;
|
||||||
|
|
||||||
|
public class SubCommandVolume extends SubCommand
|
||||||
|
{
|
||||||
|
public SubCommandVolume(KittyRole level, KittyRating rating) { super(level, rating); }
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public SubCommandFormattable OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input)
|
||||||
|
{
|
||||||
|
int newVol = guild.audio.getVolume(guild.audio.player);
|
||||||
|
if(input.args != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
newVol = Integer.parseInt(input.args);
|
||||||
|
if(newVol > 100 || newVol <1)
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable(String.format(LocStrings.stub("MusicVolOOB")));
|
||||||
|
}
|
||||||
|
guild.audio.changeVolume(guild.audio.player, newVol);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
return new SubCommandFormattable(String.format(LocStrings.stub("MusicVolCurrent"), newVol));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return new SubCommandFormattable(String.format(LocStrings.stub("MusicVolChanged"), newVol));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -387,7 +387,7 @@ public class ObjectBuilderFactory
|
|||||||
// Determine token based on config. Default to test token.
|
// Determine token based on config. Default to test token.
|
||||||
String tokenToUse = Ref.TestToken;
|
String tokenToUse = Ref.TestToken;
|
||||||
if(ConfigGlobals.getStartupMode() == KittyStartupMode.Release)
|
if(ConfigGlobals.getStartupMode() == KittyStartupMode.Release)
|
||||||
tokenToUse = Ref.Token;
|
tokenToUse = Ref.PoguToken;
|
||||||
|
|
||||||
// Construct bot based on token
|
// Construct bot based on token
|
||||||
kitty = new JDABuilder(AccountType.BOT)
|
kitty = new JDABuilder(AccountType.BOT)
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public class KittyGuild extends DatabaseTrackedObject
|
|||||||
{
|
{
|
||||||
if(!raffleUsersChosen.contains(user) && !raffleUsersUnchosen.contains(user) && user.getBeans() > raffleCost && raffling)
|
if(!raffleUsersChosen.contains(user) && !raffleUsersUnchosen.contains(user) && user.getBeans() > raffleCost && raffling)
|
||||||
{
|
{
|
||||||
user.changeBeans(raffleCost);
|
user.changeBeans(-raffleCost);
|
||||||
raffleUsersUnchosen.add(user);
|
raffleUsersUnchosen.add(user);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+75
-36
@@ -24,23 +24,55 @@ public class NetworkE6
|
|||||||
// Internal JSON class and variables //
|
// Internal JSON class and variables //
|
||||||
//////////////////////////////////.////
|
//////////////////////////////////.////
|
||||||
private static final Gson jsonParser_ = new Gson();
|
private static final Gson jsonParser_ = new Gson();
|
||||||
private static final String API_ROOT = "https://e621.net/post/index.json?";
|
private static final String API_ROOT = "https://e621.net/posts.json?";
|
||||||
private static int maxSearchResults_ = 10;
|
private static int maxSearchResults_ = 10;
|
||||||
private static String[] blacklist = Ref.e621Blacklist;
|
private static String[] blacklist = Ref.e621Blacklist;
|
||||||
|
|
||||||
private class E6ResponseObject
|
private class E6ResponseObject
|
||||||
{
|
{
|
||||||
// public varaibles matching the case and the type we want for JSON.
|
// public variables matching the case and the type we want for JSON.
|
||||||
// There are many more fields, but if we don't provide some it just
|
// There are many more fields, but if we don't provide some it just
|
||||||
// doesn't bother parsing them.
|
// doesn't bother parsing them.
|
||||||
public String file_url;
|
public E6ResponseObjectPost [] posts;
|
||||||
public String id;
|
|
||||||
public String tags;
|
|
||||||
public String [] artist;
|
|
||||||
public String [] sources;
|
|
||||||
public String score;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class E6ResponseObjectPost
|
||||||
|
{
|
||||||
|
public String id;
|
||||||
|
public String [] sources;
|
||||||
|
public String[] pools;
|
||||||
|
public String rating;
|
||||||
|
public E6ResponseObjectFile file;
|
||||||
|
public E6ResponseObjectScore score;
|
||||||
|
public E6ResponseObjectTags tags;
|
||||||
|
public E6ResponseObjectRelationships relationships;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class E6ResponseObjectFile
|
||||||
|
{
|
||||||
|
public String url;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class E6ResponseObjectScore
|
||||||
|
{
|
||||||
|
public String total;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class E6ResponseObjectTags
|
||||||
|
{
|
||||||
|
public String[] general;
|
||||||
|
public String[] artist;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class E6ResponseObjectRelationships
|
||||||
|
{
|
||||||
|
public String has_children;
|
||||||
|
public String[] children;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
@@ -59,33 +91,36 @@ public class NetworkE6
|
|||||||
// Configure and send request. Note: Random ordering added as first
|
// Configure and send request. Note: Random ordering added as first
|
||||||
// tag by default. User-provided tags, therefore, will override it.
|
// tag by default. User-provided tags, therefore, will override it.
|
||||||
// If order:score is provided, that will be honored over order:random.
|
// If order:score is provided, that will be honored over order:random.
|
||||||
String res = HTTPUtils.sendPOSTRequest(API_ROOT
|
String res = HTTPUtils.sendGETRequest(API_ROOT + "tags=order:random%20" + input + "&limit=" + maxSearchResults_);
|
||||||
, "tags=order:random%20" + input + "&limit=" + maxSearchResults_);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(res != null)
|
if(res != null)
|
||||||
{
|
{
|
||||||
// Use class evaluation on an array of the response imageObject to be able to hold multiple.
|
|
||||||
E6ResponseObject[] imageObj = jsonParser_.fromJson(res, E6ResponseObject[].class);
|
|
||||||
|
|
||||||
|
// Use class evaluation on an array of the response imageObject to be able to hold multiple.
|
||||||
|
System.out.println("Still");
|
||||||
|
E6ResponseObject imageObj = jsonParser_.fromJson(res, E6ResponseObject.class);
|
||||||
|
System.out.println("Broken");
|
||||||
// For now, we really just wanna display images and their source.
|
// For now, we really just wanna display images and their source.
|
||||||
// Append them all separately to a response string w/ some flavor text.
|
// Append them all separately to a response string w/ some flavor text.
|
||||||
if(imageObj.length < 1)
|
if(imageObj.posts.length < 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i = 0; i < imageObj.length; ++i)
|
for(int i = 0; i < imageObj.posts.length; ++i)
|
||||||
{
|
{
|
||||||
|
String [] TagsList = imageObj.posts[i].tags.general;
|
||||||
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 ++)
|
||||||
{
|
{
|
||||||
System.out.println("BLACKLISTED " + blacklist[j]);
|
if(TagsList[k].equals(blacklist[j]))
|
||||||
blacklisted = true;
|
{
|
||||||
|
System.out.println("BLACKLISTED " + blacklist[j]);
|
||||||
|
blacklisted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,10 +129,15 @@ public class NetworkE6
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// We will always have a file URL. That's a given.
|
// We will always have a file URL. That's a given.
|
||||||
image.editImageURL(imageObj[i].file_url);
|
image.editImageURL(imageObj.posts[i].file.url);
|
||||||
image.editPostURL("https://e621.net/post/show/" + imageObj[i].id);
|
image.editPostURL("https://e621.net/posts/" + imageObj.posts[i].id);
|
||||||
if(imageObj[i].artist.length > 0)
|
if(imageObj.posts[i].tags.artist.length > 0)
|
||||||
image.editArtist(imageObj[i].artist[0]);
|
{
|
||||||
|
String artists = "";
|
||||||
|
for(int j = 0; j < imageObj.posts[i].tags.artist.length; j++)
|
||||||
|
artists += imageObj.posts[i].tags.artist[j];
|
||||||
|
image.editArtist(artists);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
image.editArtist("Artist Not Found!");
|
image.editArtist("Artist Not Found!");
|
||||||
|
|
||||||
@@ -105,13 +145,13 @@ public class NetworkE6
|
|||||||
|
|
||||||
String sources = "";
|
String sources = "";
|
||||||
|
|
||||||
if(imageObj[i].sources != null)
|
if(imageObj.posts[i].sources != null)
|
||||||
{
|
{
|
||||||
for(int k = 0; k < imageObj[i].sources.length; k ++)
|
for(int k = 0; k < imageObj.posts[i].sources.length; k ++)
|
||||||
{
|
{
|
||||||
if(!imageObj[i].sources[k].endsWith(imageObj[i].file_url.substring(imageObj[i].file_url.lastIndexOf('.'))))
|
if(!imageObj.posts[i].sources[k].endsWith(imageObj.posts[i].file.url.substring(imageObj.posts[i].file.url.lastIndexOf('.'))))
|
||||||
{
|
{
|
||||||
String source = imageObj[i].sources[k];
|
String source = imageObj.posts[i].sources[k];
|
||||||
if(source.contains("//www."))
|
if(source.contains("//www."))
|
||||||
{
|
{
|
||||||
source = source.substring(source.indexOf(".") + 1);
|
source = source.substring(source.indexOf(".") + 1);
|
||||||
@@ -122,31 +162,30 @@ public class NetworkE6
|
|||||||
source = source.substring(source.indexOf("/") + 2);
|
source = source.substring(source.indexOf("/") + 2);
|
||||||
source = source.substring(0, source.indexOf('.'));
|
source = source.substring(0, source.indexOf('.'));
|
||||||
}
|
}
|
||||||
sources += " [" + source + "](" + imageObj[i].sources[k] + ") ";
|
sources += " [" + source + "](" + imageObj.posts[i].sources[k] + ") ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
image.editDescriptionText("Score: " + imageObj[i].score + "\n**Source:**" + sources);
|
image.editDescriptionText("Score: " + imageObj.posts[i].score.total + "\n**Source:**" + sources);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image.editDescriptionText("Score: " + imageObj[i].score);
|
image.editDescriptionText("Score: " + imageObj.posts[i].score.total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String descTags = "";
|
||||||
if(imageObj[i].tags.split(" ").length > 15)
|
if(imageObj.posts[i].tags.general.length > 15)
|
||||||
{
|
{
|
||||||
String [] splitTags = imageObj[i].tags.split(" ");
|
|
||||||
String descTags = "";
|
|
||||||
for(int o = 0; o < 15; o++)
|
for(int o = 0; o < 15; o++)
|
||||||
{
|
{
|
||||||
descTags += splitTags[o] + ", ";
|
descTags += imageObj.posts[i].tags.general[o] + ", ";
|
||||||
}
|
}
|
||||||
image.editFooterText("[Tags] " + descTags + " etc.");
|
image.editFooterText("[Tags] " + descTags + " etc.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image.editFooterText("[Tags] " + imageObj[i].tags.replace(" ", ", "));
|
descTags = imageObj.posts[i].tags.general.toString();
|
||||||
|
image.editFooterText("[Tags] " + descTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(image.output().authorText != null)
|
if(image.output().authorText != null)
|
||||||
|
|||||||
@@ -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];
|
||||||
|
|||||||
@@ -73,9 +73,22 @@ public class NetworkTheColorAPI
|
|||||||
|
|
||||||
public ColorData lookupHex(String hex)
|
public ColorData lookupHex(String hex)
|
||||||
{
|
{
|
||||||
|
if(hex == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
hex = hex.replace("#", "").trim();
|
||||||
|
int len = hex.length();
|
||||||
|
|
||||||
|
if(len == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// Verify we're either a full or half length color. Intermediate colors not supported.
|
||||||
|
// Alpha is also not supported.
|
||||||
|
if(len != 6 && len != 3)
|
||||||
|
return null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
hex = hex.replace("#", "").trim();
|
|
||||||
String hexUpper = hex.toUpperCase();
|
String hexUpper = hex.toUpperCase();
|
||||||
|
|
||||||
// Verify the number is hex.
|
// Verify the number is hex.
|
||||||
|
|||||||
@@ -119,6 +119,16 @@ public class AudioUtils
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getVolume(AudioPlayer player)
|
||||||
|
{
|
||||||
|
return player.getVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeVolume(AudioPlayer player, int newVol)
|
||||||
|
{
|
||||||
|
player.setVolume(newVol);
|
||||||
|
}
|
||||||
|
|
||||||
public String skipVideo(AudioPlayer player)
|
public String skipVideo(AudioPlayer player)
|
||||||
{
|
{
|
||||||
player.stopTrack();
|
player.stopTrack();
|
||||||
@@ -152,6 +162,9 @@ class MusicController extends Thread
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
Thread.sleep(5000);
|
||||||
|
} catch (InterruptedException e) {}
|
||||||
AudioTrack nowPlaying = null;
|
AudioTrack nowPlaying = null;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user