Changed blurple to reflect the new Discord rebrand

This commit is contained in:
TheEssem 2021-05-13 17:19:28 -05:00
parent 79bc36759c
commit ad87722fd2
No known key found for this signature in database
GPG key ID: A3F9F02129092FCA
2 changed files with 10 additions and 1 deletions

View file

@ -1,7 +1,14 @@
const ImageCommand = require("../../classes/imageCommand.js"); const ImageCommand = require("../../classes/imageCommand.js");
class BlurpleCommand extends ImageCommand { class BlurpleCommand extends ImageCommand {
params(args) {
return {
old: args.length !== 0 && args[0].toLowerCase() === "old" ? true : false
};
}
static description = "Turns an image blurple"; static description = "Turns an image blurple";
static arguments = ["{old}"];
static noImage = "you need to provide an image to make blurple!"; static noImage = "you need to provide an image to make blurple!";
static command = "blurple"; static command = "blurple";

View file

@ -12,6 +12,8 @@ Napi::Value Blurple(const Napi::CallbackInfo &info) {
try { try {
Napi::Object obj = info[0].As<Napi::Object>(); Napi::Object obj = info[0].As<Napi::Object>();
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>(); Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
bool old =
obj.Has("old") ? obj.Get("old").As<Napi::Boolean>().Value() : false;
string type = obj.Get("type").As<Napi::String>().Utf8Value(); string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = int delay =
obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0; obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0;
@ -26,7 +28,7 @@ Napi::Value Blurple(const Napi::CallbackInfo &info) {
for (Image &image : coalesced) { for (Image &image : coalesced) {
image.threshold(49151.25); image.threshold(49151.25);
image.levelColors("#7289DA", "white"); image.levelColors(old ? "#7289DA" : "#5865F2", "white");
image.magick(type); image.magick(type);
image.animationDelay(delay == 0 ? image.animationDelay() : delay); image.animationDelay(delay == 0 ? image.animationDelay() : delay);
blurpled.push_back(image); blurpled.push_back(image);