= Format updates and color iteration
This commit is contained in:
@@ -39,7 +39,7 @@ public class CommandBlurry extends Command
|
||||
{
|
||||
try
|
||||
{
|
||||
filename = ImageUtils.DownloadFromURL(input.args.split(" ")[0], ".png");
|
||||
filename = ImageUtils.downloadFromURL(input.args.split(" ")[0], ".png");
|
||||
preProcessed = new File(filename);
|
||||
}
|
||||
catch(Exception e)
|
||||
@@ -48,7 +48,7 @@ public class CommandBlurry extends Command
|
||||
if(input.mentions != null)
|
||||
person = input.mentions[0];
|
||||
|
||||
filename = ImageUtils.DownloadFromURL(person.avatarID, ".png");
|
||||
filename = ImageUtils.downloadFromURL(person.avatarID, ".png");
|
||||
if(filename == null)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CommandCatch extends Command
|
||||
else
|
||||
person = input.mentions[0];
|
||||
|
||||
String catchFilename = ImageUtils.DownloadFromURL(person.avatarID, ".png");
|
||||
String catchFilename = ImageUtils.downloadFromURL(person.avatarID, ".png");
|
||||
if(catchFilename == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package commands;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
@@ -16,6 +17,8 @@ import dataStructures.KittyRole;
|
||||
import dataStructures.KittyUser;
|
||||
import dataStructures.Response;
|
||||
import dataStructures.UserInput;
|
||||
import utils.GlobalLog;
|
||||
import utils.ImageUtils;
|
||||
|
||||
public class CommandColor extends Command
|
||||
{
|
||||
@@ -27,26 +30,35 @@ public class CommandColor extends Command
|
||||
@Override
|
||||
public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)
|
||||
{
|
||||
// Config
|
||||
int sideLength = 50;
|
||||
|
||||
float r = 0;
|
||||
float g = 0;
|
||||
float b = 0;
|
||||
float r = 209.0f/255;
|
||||
float g = 74.0f/255;
|
||||
float b = 153.0f/255;
|
||||
float a = 1;
|
||||
Color parsed = new Color(r, g, b, a);
|
||||
|
||||
GlobalLog.Log("1");
|
||||
|
||||
// Construct the image example file that we intend to display locally
|
||||
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();
|
||||
|
||||
GlobalLog.Log("2");
|
||||
String tempFileName = ImageUtils.writeTempImageData(img, ".png");
|
||||
File file = new File(tempFileName);
|
||||
GlobalLog.Log("3");
|
||||
KittyEmbed response = new KittyEmbed();
|
||||
response.title = "Color Name";
|
||||
response.color = parsed;
|
||||
response.thumbnailURL = "attachment://test.png";
|
||||
|
||||
response.descriptionText = "`rgba` test\n`hex` test\n`hsv` test";
|
||||
response.thumbnailURL = "attachment://" + tempFileName;
|
||||
GlobalLog.Log("4");
|
||||
res.CallEmbed(response);
|
||||
//ImageIO.write(bufferedImage, "png", file);
|
||||
ImageUtils.BlockingFileDelete(file);
|
||||
GlobalLog.Log("5");
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class CommandPerish extends Command
|
||||
{
|
||||
try
|
||||
{
|
||||
filename = ImageUtils.DownloadFromURL(input.args.split(" ")[0], ".png");
|
||||
filename = ImageUtils.downloadFromURL(input.args.split(" ")[0], ".png");
|
||||
preProcessed = new File(filename);
|
||||
}
|
||||
catch(Exception e)
|
||||
@@ -54,7 +54,7 @@ public class CommandPerish extends Command
|
||||
if(input.mentions != null)
|
||||
person = input.mentions[0];
|
||||
|
||||
filename = ImageUtils.DownloadFromURL(person.avatarID, ".png");
|
||||
filename = ImageUtils.downloadFromURL(person.avatarID, ".png");
|
||||
if(filename == null)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CommandStark extends Command
|
||||
{
|
||||
try
|
||||
{
|
||||
filename = ImageUtils.DownloadFromURL(input.args.split(" ")[0], ".png");
|
||||
filename = ImageUtils.downloadFromURL(input.args.split(" ")[0], ".png");
|
||||
preProcessed = new File(filename);
|
||||
}
|
||||
catch(Exception e)
|
||||
@@ -48,7 +48,7 @@ public class CommandStark extends Command
|
||||
if(input.mentions != null)
|
||||
person = input.mentions[0];
|
||||
|
||||
filename = ImageUtils.DownloadFromURL(person.avatarID, ".png");
|
||||
filename = ImageUtils.downloadFromURL(person.avatarID, ".png");
|
||||
if(filename == null)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CommandTeey extends Command
|
||||
else
|
||||
person = input.mentions[0];
|
||||
|
||||
String yeeteeFilename = ImageUtils.DownloadFromURL(person.avatarID, ".png");
|
||||
String yeeteeFilename = ImageUtils.downloadFromURL(person.avatarID, ".png");
|
||||
if(yeeteeFilename == null)
|
||||
return;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class CommandWolfram extends Command
|
||||
res.CallFile(pic, "png");
|
||||
ImageUtils.BlockingFileDelete(pic);
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (IOException e)
|
||||
{
|
||||
res.Call(LocStrings.Stub("WolframError"));
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CommandYeet extends Command
|
||||
else
|
||||
person = input.mentions[0];
|
||||
|
||||
String yeeteeFilename = ImageUtils.DownloadFromURL(person.avatarID, ".png");
|
||||
String yeeteeFilename = ImageUtils.downloadFromURL(person.avatarID, ".png");
|
||||
if(yeeteeFilename == null)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user