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");
class BlurpleCommand extends ImageCommand {
params(args) {
return {
old: args.length !== 0 && args[0].toLowerCase() === "old" ? true : false
};
}
static description = "Turns an image blurple";
static arguments = ["{old}"];
static noImage = "you need to provide an image to make blurple!";
static command = "blurple";

View File

@ -12,6 +12,8 @@ Napi::Value Blurple(const Napi::CallbackInfo &info) {
try {
Napi::Object obj = info[0].As<Napi::Object>();
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();
int delay =
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) {
image.threshold(49151.25);
image.levelColors("#7289DA", "white");
image.levelColors(old ? "#7289DA" : "#5865F2", "white");
image.magick(type);
image.animationDelay(delay == 0 ? image.animationDelay() : delay);
blurpled.push_back(image);