diff --git a/commands.config b/commands.config index 14ef218..ff56f10 100644 --- a/commands.config +++ b/commands.config @@ -10,6 +10,7 @@ c++, g++, cplus, cpp=1 catch=1 charactercreate=1 choose=1 +color, colour=1 crouton=1 dbflush=1 dbstats=1 diff --git a/locCommands.config b/locCommands.config index bbad5ef..26a3701 100644 --- a/locCommands.config +++ b/locCommands.config @@ -11,6 +11,7 @@ bet= guildrolelist= stats= catch= +color, colour= guildroleadd= results= wolfram= diff --git a/locStrings.config b/locStrings.config index e171a11..cfe7b88 100644 --- a/locStrings.config +++ b/locStrings.config @@ -89,6 +89,9 @@ RaffleEndSuccess= RaffleEndInfo= RaffleEndFailure=I don't think there's one going! +[CommandColor] +ColorInfo= + [CommandDoWork] DoWorkFinished=I finished with my work! :D DoWorkInfo=Occupies a core for a few seconds @@ -153,7 +156,7 @@ WolframInfo=Will query wolframalpha with your question and give a full image out WolframNoArgs=You need to provide some arguments! [CommandMap] -MapInfo=Generates a map! You can pass additional information if you want with the flags `-s-w-h`. If one of the fields isn't provided, its default will be used. Note that adjusting the width and height impacts the map outcomes.\n\nDefault seed: Random,\nDefault Width: 35(max %s),\nDefault Height: 25(max %s) +MapInfo=Generates a map! You can pass additional information if you want with the flags `-s -w -h`. If one of the fields isn't provided, its default will be used. Note that adjusting the width and height impacts the map outcomes.\n\n**Defaults**\nDefault Seed: Random,\nDefault Width: 35(max %s),\nDefault Height: 25(max %s)\n\n**Key**\nLand: ˶\nMountain: ▲\nBeach: =\nMarsh: ¥\nLava: # MapSeed=Seed MapInvalid=Invalid arguments provided! MapVersion=Using mapgen v0.1 diff --git a/src/commands/CommandColor.java b/src/commands/CommandColor.java new file mode 100644 index 0000000..aac5c04 --- /dev/null +++ b/src/commands/CommandColor.java @@ -0,0 +1,52 @@ +package commands; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; + +import javax.imageio.ImageIO; + +import core.Command; +import core.LocStrings; +import dataStructures.KittyChannel; +import dataStructures.KittyEmbed; +import dataStructures.KittyGuild; +import dataStructures.KittyRating; +import dataStructures.KittyRole; +import dataStructures.KittyUser; +import dataStructures.Response; +import dataStructures.UserInput; + +public class CommandColor extends Command +{ + public CommandColor(KittyRole level, KittyRating rating) { super(level, rating); } + + @Override + public String HelpText() { return LocStrings.Stub("ColorInfo"); } + + @Override + public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) + { + int sideLength = 50; + + float r = 0; + float g = 0; + float b = 0; + float a = 1; + Color parsed = new Color(r, g, b, a); + + BufferedImage img = new BufferedImage(sideLength, sideLength, BufferedImage.TYPE_4BYTE_ABGR); + Graphics2D graphics = img.createGraphics(); + graphics.setColor(parsed); + graphics.fillRect(0, 0, sideLength, sideLength); + graphics.dispose(); + + KittyEmbed response = new KittyEmbed(); + response.color = parsed; + response.thumbnailURL = "attachment://test.png"; + + res.CallEmbed(response); + //ImageIO.write(bufferedImage, "png", file); + }; + +} diff --git a/src/commands/CommandHelp.java b/src/commands/CommandHelp.java index fd5bd0f..b507f6d 100644 --- a/src/commands/CommandHelp.java +++ b/src/commands/CommandHelp.java @@ -26,10 +26,6 @@ public class CommandHelp extends Command { help = LocStrings.Stub("HelpDisplay"); } - else - { - help = "`" + input.args + "`: " + help; - } res.Call(help); } diff --git a/src/core/ObjectBuilderFactory.java b/src/core/ObjectBuilderFactory.java index 66c8ad0..5fee819 100644 --- a/src/core/ObjectBuilderFactory.java +++ b/src/core/ObjectBuilderFactory.java @@ -425,6 +425,7 @@ public class ObjectBuilderFactory manager.Register(LocCommands.Stub("rafflejoin"), new CommandRaffleJoin(KittyRole.General, KittyRating.Safe)); manager.Register(LocCommands.Stub("charactercreate"), new CommandCharacterCreate(KittyRole.General, KittyRating.Safe)); manager.Register(LocCommands.Stub("leaderboard"), new CommandLeaderboard(KittyRole.General, KittyRating.Safe)); + manager.Register(LocCommands.Stub("color, colour"), new CommandColor(KittyRole.General, KittyRating.Safe)); return manager; } diff --git a/src/dataStructures/KittyEmbed.java b/src/dataStructures/KittyEmbed.java index 3bc8382..c871bbe 100644 --- a/src/dataStructures/KittyEmbed.java +++ b/src/dataStructures/KittyEmbed.java @@ -4,7 +4,7 @@ import java.awt.Color; public class KittyEmbed { - public String title = null; + public String title = null; // Required, but if this remails null or is empty, it's made a blank space in Response.java. public Color color = null; public String footerText = null; public String authorText = null; @@ -13,9 +13,5 @@ public class KittyEmbed public String descriptionText = null; public String bodyImageURL = null; public String imageURL = null; - - - public KittyEmbed() - { - } + public String thumbnailURL = null; // Did you know? This is the only field that can actually be a local image file. Use attachment://file.png as the string for it. } diff --git a/src/dataStructures/Response.java b/src/dataStructures/Response.java index 012130b..afbc8a4 100644 --- a/src/dataStructures/Response.java +++ b/src/dataStructures/Response.java @@ -33,8 +33,10 @@ public class Response { EmbedBuilder embed = new EmbedBuilder(); - if(embedInfo.title != null) + if(embedInfo.title != null && !embedInfo.title.isEmpty()) embed.setTitle(embedInfo.title); + else + embed.setTitle(" "); if(embedInfo.color != null) embed.setColor(embedInfo.color); @@ -49,7 +51,10 @@ public class Response embed.setAuthor(embedInfo.authorText, embedInfo.authorLink, embedInfo.authorImage); if(embedInfo.imageURL != null) - embed.setImage(embedInfo.imageURL); + embed.setImage(embedInfo.imageURL); + + if(embedInfo.thumbnailURL != null) + embed.setThumbnail(embedInfo.thumbnailURL); event.getChannel().sendMessage(embed.build()).queue(); } diff --git a/test.png b/test.png new file mode 100644 index 0000000..0c987f9 Binary files /dev/null and b/test.png differ