Begin the purge
This commit is contained in:
parent
1a86730489
commit
4ac90bc761
17 changed files with 0 additions and 337 deletions
Binary file not shown.
Before Width: | Height: | Size: 39 KiB |
Binary file not shown.
Before Width: | Height: | Size: 350 KiB |
Binary file not shown.
Before Width: | Height: | Size: 68 KiB |
|
@ -1,23 +0,0 @@
|
|||
import { say } from "cowsay2";
|
||||
import cows from "cowsay2/cows/index.js";
|
||||
import Command from "../../classes/command.js";
|
||||
|
||||
class CowsayCommand extends Command {
|
||||
async run() {
|
||||
if (this.args.length === 0) {
|
||||
return "You need to provide some text for the cow to say!";
|
||||
} else if (cows[this.args[0].toLowerCase()] != undefined) {
|
||||
const cow = cows[this.args.shift().toLowerCase()];
|
||||
return `\`\`\`\n${say(this.args.join(" "), { cow })}\n\`\`\``;
|
||||
} else {
|
||||
return `\`\`\`\n${say(this.args.join(" "))}\n\`\`\``;
|
||||
}
|
||||
}
|
||||
|
||||
static description = "Makes an ASCII cow say a message";
|
||||
static aliases = ["cow"];
|
||||
static arguments = ["{cow}", "[text]"];
|
||||
static slashAllowed = false;
|
||||
}
|
||||
|
||||
export default CowsayCommand;
|
|
@ -1,15 +0,0 @@
|
|||
import Command from "../../classes/command.js";
|
||||
|
||||
class FullwidthCommand extends Command {
|
||||
async run() {
|
||||
if (this.args.length === 0) return "You need to provide some text to convert to fullwidth!";
|
||||
return this.args.join("").replaceAll(/[A-Za-z0-9]/g, (s) => { return String.fromCharCode(s.charCodeAt(0) + 0xFEE0); });
|
||||
}
|
||||
|
||||
static description = "Converts a message to fullwidth/aesthetic text";
|
||||
static aliases = ["aesthetic", "aesthetics", "aes"];
|
||||
static arguments = ["[text]"];
|
||||
static slashAllowed = false;
|
||||
}
|
||||
|
||||
export default FullwidthCommand;
|
|
@ -1,33 +0,0 @@
|
|||
import wrap from "../../utils/wrap.js";
|
||||
import ImageCommand from "../../classes/imageCommand.js";
|
||||
|
||||
class RetroCommand extends ImageCommand {
|
||||
params() {
|
||||
let [line1, line2, line3] = this.args.join(" ").replaceAll("&", "\\&").replaceAll(">", "\\>").replaceAll("<", "\\<").replaceAll("\"", "\\"").replaceAll("'", "\\'").replaceAll("%", "\\%").split(",").map(elem => elem.trim());
|
||||
if (!line2 && line1.length > 15) {
|
||||
const [split1, split2, split3] = wrap(line1, { width: 15, indent: "" }).split("\n");
|
||||
line1 = split1;
|
||||
line2 = split2 ?? "";
|
||||
line3 = split3 ?? "";
|
||||
} else {
|
||||
if (!line2) {
|
||||
line2 = "";
|
||||
}
|
||||
if (!line3) {
|
||||
line3 = "";
|
||||
}
|
||||
}
|
||||
return { line1, line2, line3 };
|
||||
}
|
||||
|
||||
static description = "Generates a retro text image (separate lines with a comma)";
|
||||
static arguments = ["[top text]", "{middle text}", "{bottom text}"];
|
||||
|
||||
static requiresImage = false;
|
||||
static requiresText = true;
|
||||
static noText = "You need to provide some text to make retro!";
|
||||
static command = "retro";
|
||||
static slashAllowed = false;
|
||||
}
|
||||
|
||||
export default RetroCommand;
|
|
@ -1,35 +0,0 @@
|
|||
import { random } from "../../utils/misc.js";
|
||||
import Command from "../../classes/command.js";
|
||||
|
||||
class RPSCommand extends Command {
|
||||
async run() {
|
||||
if (this.args.length === 0 || (this.args[0] !== "rock" && this.args[0] !== "paper" && this.args[0] !== "scissors")) return "You need to choose whether you want to be rock, paper, or scissors!";
|
||||
let emoji;
|
||||
let winOrLose;
|
||||
const result = random(["rock", "paper", "scissors"]);
|
||||
switch (result) {
|
||||
case "rock":
|
||||
emoji = "✊";
|
||||
if (this.args[0].toLowerCase() === "paper") winOrLose = true;
|
||||
break;
|
||||
case "paper":
|
||||
emoji = "✋";
|
||||
if (this.args[0].toLowerCase() === "scissors") winOrLose = true;
|
||||
break;
|
||||
case "scissors":
|
||||
emoji = "✌";
|
||||
if (this.args[0].toLowerCase() === "rock") winOrLose = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return this.args[0].toLowerCase() === result ? `${emoji} I chose ${result}. It's a tie!` : `${emoji} I chose ${result}. ${winOrLose ? "You win!" : "You lose!"}`;
|
||||
}
|
||||
|
||||
static description = "Plays rock, paper, scissors with me";
|
||||
static aliases = ["rockpaperscissors"];
|
||||
static arguments = ["[rock/paper/scissors]"];
|
||||
static slashAllowed = false;
|
||||
}
|
||||
|
||||
export default RPSCommand;
|
|
@ -1,31 +0,0 @@
|
|||
import fetch from "node-fetch";
|
||||
import Command from "../../classes/command.js";
|
||||
|
||||
class XKCDCommand extends Command {
|
||||
async run() {
|
||||
const url = this.args.length > 0 && this.args[0].match(/^\d+$/) ? `http://xkcd.com/${this.args[0]}/info.0.json` : "http://xkcd.com/info.0.json";
|
||||
try {
|
||||
const request = await fetch(url);
|
||||
const json = await request.json();
|
||||
return {
|
||||
embeds: [{
|
||||
title: json.safe_title,
|
||||
url: `https://xkcd.com/${json.num}`,
|
||||
color: 16711680,
|
||||
description: json.alt,
|
||||
image: {
|
||||
url: json.img
|
||||
}
|
||||
}]
|
||||
};
|
||||
} catch {
|
||||
return "I couldn't get that XKCD!";
|
||||
}
|
||||
}
|
||||
|
||||
static description = "Gets an XKCD comic";
|
||||
static arguments = ["{id}"];
|
||||
static slashAllowed = false;
|
||||
}
|
||||
|
||||
export default XKCDCommand;
|
|
@ -1,13 +0,0 @@
|
|||
import Command from "../../classes/command.js";
|
||||
|
||||
class InviteCommand extends Command {
|
||||
async run() {
|
||||
return "You can invite me to your server here: <https://projectlounge.pw/invite>";
|
||||
}
|
||||
|
||||
static description = "Gets my invite link";
|
||||
static aliases = ["botinfo", "credits"];
|
||||
static slashAllowed = false;
|
||||
}
|
||||
|
||||
export default InviteCommand;
|
|
@ -1,11 +0,0 @@
|
|||
import ImageCommand from "../../classes/imageCommand.js";
|
||||
|
||||
class WhoDidThisCommand extends ImageCommand {
|
||||
static description = "Creates a \"WHO DID THIS\" meme from an image";
|
||||
static aliases = ["whodidthis"];
|
||||
|
||||
static noImage = "You need to provide an image/GIF to make a \"who did this\" meme!";
|
||||
static command = "wdt";
|
||||
}
|
||||
|
||||
export default WhoDidThisCommand;
|
|
@ -1,7 +1,5 @@
|
|||
#include <napi.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <vips/vips8>
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <napi.h>
|
||||
#include <list>
|
||||
#include "blur.h"
|
||||
#include "colors.h"
|
||||
#include "caption.h"
|
||||
|
@ -23,7 +22,6 @@
|
|||
#include "motivate.h"
|
||||
#include "reddit.h"
|
||||
#include "resize.h"
|
||||
#include "retro.h"
|
||||
#include "reverse.h"
|
||||
#include "scott.h"
|
||||
#include "snapchat.h"
|
||||
|
@ -34,7 +32,6 @@
|
|||
#include "uncaption.h"
|
||||
#include "wall.h"
|
||||
#include "watermark.h"
|
||||
#include "wdt.h"
|
||||
#include "whisper.h"
|
||||
#include "zamn.h"
|
||||
|
||||
|
@ -72,7 +69,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|||
exports.Set(Napi::String::New(env, "motivate"), Napi::Function::New(env, Motivate));
|
||||
exports.Set(Napi::String::New(env, "reddit"), Napi::Function::New(env, Reddit));
|
||||
exports.Set(Napi::String::New(env, "resize"), Napi::Function::New(env, Resize));
|
||||
exports.Set(Napi::String::New(env, "retro"), Napi::Function::New(env, Retro));
|
||||
exports.Set(Napi::String::New(env, "reverse"), Napi::Function::New(env, Reverse));
|
||||
exports.Set(Napi::String::New(env, "scott"), Napi::Function::New(env, Scott));
|
||||
exports.Set(Napi::String::New(env, "snapchat"), Napi::Function::New(env, Snapchat));
|
||||
|
@ -84,7 +80,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|||
exports.Set(Napi::String::New(env, "uncaption"), Napi::Function::New(env, Uncaption));
|
||||
exports.Set(Napi::String::New(env, "wall"), Napi::Function::New(env, Wall));
|
||||
exports.Set(Napi::String::New(env, "watermark"), Napi::Function::New(env, Watermark));
|
||||
exports.Set(Napi::String::New(env, "wdt"), Napi::Function::New(env, Wdt));
|
||||
exports.Set(Napi::String::New(env, "whisper"), Napi::Function::New(env, Whisper));
|
||||
exports.Set(Napi::String::New(env, "zamn"), Napi::Function::New(env, Zamn));
|
||||
return exports;
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
#include <Magick++.h>
|
||||
#include <napi.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
Napi::Value Retro(const Napi::CallbackInfo &info) {
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
try {
|
||||
Napi::Object obj = info[0].As<Napi::Object>();
|
||||
string line1 = obj.Get("line1").As<Napi::String>().Utf8Value();
|
||||
string line2 = obj.Get("line2").As<Napi::String>().Utf8Value();
|
||||
string line3 = obj.Get("line3").As<Napi::String>().Utf8Value();
|
||||
string basePath = obj.Get("basePath").As<Napi::String>().Utf8Value();
|
||||
|
||||
Blob blob;
|
||||
|
||||
Image image;
|
||||
Image line1_text;
|
||||
Image line2_text;
|
||||
Image line3_text;
|
||||
|
||||
image.read(basePath + "assets/images/retro.png");
|
||||
|
||||
line2_text.backgroundColor("none");
|
||||
line2_text.fontPointsize(128);
|
||||
line2_text.textGravity(Magick::CenterGravity);
|
||||
line2_text.font("Comic Sans MS");
|
||||
line2_text.read("pango:<span foreground='white'>" +
|
||||
(line2 == "" ? line1 : line2) + "</span>");
|
||||
line2_text.extent(Geometry("1260x859+0+0"), Magick::CenterGravity);
|
||||
Image line2_text_fill = line2_text;
|
||||
line2_text_fill.channel(Magick::AlphaChannel);
|
||||
line2_text_fill.morphology(Magick::EdgeOutMorphology, "Octagon:10");
|
||||
line2_text_fill.backgroundColor("gray");
|
||||
line2_text_fill.alphaChannel(Magick::ShapeAlphaChannel);
|
||||
line2_text.composite(line2_text_fill, Magick::CenterGravity,
|
||||
Magick::DstOverCompositeOp);
|
||||
image.composite(line2_text, Geometry("+0-100"), Magick::OverCompositeOp);
|
||||
|
||||
if (line2 != "") {
|
||||
line1_text.backgroundColor("none");
|
||||
line1_text.fontPointsize(64);
|
||||
line1_text.textGravity(Magick::CenterGravity);
|
||||
line1_text.font("Comic Sans MS");
|
||||
line1_text.read("pango:<span foreground='white'>" + line1 + "</span>");
|
||||
line1_text.extent(Geometry("1260x859+0+0"), Magick::CenterGravity);
|
||||
Image line1_text_fill = line1_text;
|
||||
line1_text_fill.channel(Magick::AlphaChannel);
|
||||
line1_text_fill.morphology(Magick::EdgeOutMorphology, "Octagon:10");
|
||||
line1_text_fill.backgroundColor("gray");
|
||||
line1_text_fill.alphaChannel(Magick::ShapeAlphaChannel);
|
||||
line1_text.composite(line1_text_fill, Magick::CenterGravity,
|
||||
Magick::DstOverCompositeOp);
|
||||
image.composite(line1_text, Geometry("+0-250"), Magick::OverCompositeOp);
|
||||
}
|
||||
|
||||
if (line3 != "") {
|
||||
line3_text.backgroundColor("none");
|
||||
line3_text.fontPointsize(64);
|
||||
line3_text.textGravity(Magick::CenterGravity);
|
||||
line3_text.font("Comic Sans MS");
|
||||
line3_text.read("pango:<span foreground='white'>" + line3 + "</span>");
|
||||
line3_text.extent(Geometry("1260x859+0+0"), Magick::CenterGravity);
|
||||
Image line3_text_fill = line3_text;
|
||||
line3_text_fill.channel(Magick::AlphaChannel);
|
||||
line3_text_fill.morphology(Magick::EdgeOutMorphology, "Octagon:10");
|
||||
line3_text_fill.backgroundColor("gray");
|
||||
line3_text_fill.alphaChannel(Magick::ShapeAlphaChannel);
|
||||
line3_text.composite(line3_text_fill, Magick::CenterGravity,
|
||||
Magick::DstOverCompositeOp);
|
||||
image.composite(line3_text, Geometry("+0+50"), Magick::OverCompositeOp);
|
||||
}
|
||||
|
||||
image.magick("PNG");
|
||||
image.write(&blob);
|
||||
|
||||
Napi::Object result = Napi::Object::New(env);
|
||||
result.Set("data", Napi::Buffer<char>::Copy(env, (char *)blob.data(),
|
||||
blob.length()));
|
||||
result.Set("type", "png");
|
||||
return result;
|
||||
} catch (std::exception const &err) {
|
||||
throw Napi::Error::New(env, err.what());
|
||||
} catch (...) {
|
||||
throw Napi::Error::New(env, "Unknown error");
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Retro(const Napi::CallbackInfo& info);
|
|
@ -1,7 +1,5 @@
|
|||
#include <napi.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <vips/vips8>
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
#include <Magick++.h>
|
||||
#include <napi.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
using namespace std;
|
||||
using namespace Magick;
|
||||
|
||||
Napi::Value Wdt(const Napi::CallbackInfo &info) {
|
||||
Napi::Env env = info.Env();
|
||||
|
||||
try {
|
||||
Napi::Object obj = info[0].As<Napi::Object>();
|
||||
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
|
||||
string type = obj.Get("type").As<Napi::String>().Utf8Value();
|
||||
string basePath = obj.Get("basePath").As<Napi::String>().Utf8Value();
|
||||
|
||||
Blob blob;
|
||||
|
||||
list<Image> frames;
|
||||
list<Image> coalesced;
|
||||
list<Image> mid;
|
||||
Image watermark;
|
||||
try {
|
||||
readImages(&frames, Blob(data.Data(), data.Length()));
|
||||
} catch (Magick::WarningCoder &warning) {
|
||||
cerr << "Coder Warning: " << warning.what() << endl;
|
||||
} catch (Magick::Warning &warning) {
|
||||
cerr << "Warning: " << warning.what() << endl;
|
||||
}
|
||||
watermark.read(basePath + "assets/images/whodidthis.png");
|
||||
coalesceImages(&coalesced, frames.begin(), frames.end());
|
||||
|
||||
for (Image &image : coalesced) {
|
||||
Image watermark_new = watermark;
|
||||
image.scale(Geometry("374x374>"));
|
||||
watermark_new.composite(image, Magick::CenterGravity,
|
||||
Magick::OverCompositeOp);
|
||||
watermark_new.magick(type);
|
||||
watermark_new.animationDelay(image.animationDelay());
|
||||
mid.push_back(watermark_new);
|
||||
}
|
||||
|
||||
optimizeTransparency(mid.begin(), mid.end());
|
||||
|
||||
if (type == "gif") {
|
||||
for (Image &image : mid) {
|
||||
image.quantizeDitherMethod(FloydSteinbergDitherMethod);
|
||||
image.quantize();
|
||||
}
|
||||
}
|
||||
|
||||
writeImages(mid.begin(), mid.end(), &blob);
|
||||
|
||||
Napi::Object result = Napi::Object::New(env);
|
||||
result.Set("data", Napi::Buffer<char>::Copy(env, (char *)blob.data(),
|
||||
blob.length()));
|
||||
result.Set("type", type);
|
||||
return result;
|
||||
} catch (std::exception const &err) {
|
||||
throw Napi::Error::New(env, err.what());
|
||||
} catch (...) {
|
||||
throw Napi::Error::New(env, "Unknown error");
|
||||
}
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <napi.h>
|
||||
|
||||
Napi::Value Wdt(const Napi::CallbackInfo& info);
|
Loading…
Reference in a new issue