fix lazyWebpack.construct, lint uwuify

main
Vendicated 2 years ago
parent b101e643d5
commit e0bbdd89bd
No known key found for this signature in database
GPG Key ID: EC781ADFB93EFFA3

@ -1,7 +1,7 @@
import definePlugin from "../utils/types";
import { findOption, RequiredMessageOption } from "../api/Commands";
//words have a chance of ending with these
// words have a chance of ending with these
const endings = [
"owo",
"UwU",
@ -25,7 +25,7 @@ const endings = [
"*sweats*",
];
//replacement words
// replacement words
const words = [
["love", "wuv"],
["mr", "mistuh"],
@ -45,70 +45,69 @@ const words = [
];
//uwuify command
// uwuify command
function uwuify(message: string): string {
let isowo = false;
return message
.split(" ")
.map(element => {
isowo = false;
let lowerCase = element.toLowerCase();
//return if the word is too short - uwuifying short words makes them unreadable
if (element.length < 4) {
return element;
.map(w => {
let owofied = false;
let lowerCase = w.toLowerCase();
// return if the word is too short - uwuifying short words makes them unreadable
if (w.length < 4) {
return w;
}
//replacing the words based on the array on line 29
// replacing the words based on the array on line 29
for (let [find, replace] of words) {
if (element.includes(find)) {
element = element.replace(find, replace);
isowo = true;
if (w.includes(find)) {
w = w.replace(find, replace);
owofied = true;
}
}
//these are the biggest word changes. if any of these are done we dont do the
//ones after the isowo check. to keep the words somewhat readable
// these are the biggest word changes. if any of these are done we dont do the
// ones after the isowo check. to keep the words somewhat readable
if (lowerCase.includes("u") && !lowerCase.includes("uwu")) {
element = element.replace("u", "UwU");
isowo = true;
w = w.replace("u", "UwU");
owofied = true;
}
if (lowerCase.includes("o") && !lowerCase.includes("owo")) {
element = element.replace("o", "OwO");
isowo = true;
w = w.replace("o", "OwO");
owofied = true;
}
if (lowerCase.endsWith("y") && element.length < 7) {
element = element + " " + "w" + element.slice(1);
isowo = true;
if (lowerCase.endsWith("y") && w.length < 7) {
w = w + " " + "w" + w.slice(1);
owofied = true;
}
//returning if word has been already uwuified - to prevent over-uwuifying
if (isowo) {
return element;
// returning if word has been already uwuified - to prevent over-uwuifying
if (owofied) {
return w;
}
//more tiny changes - to keep the words that passed through the latter changes uwuified
// more tiny changes - to keep the words that passed through the latter changes uwuified
if (!lowerCase.endsWith("n")) {
element = element.replace("n", "ny");
w = w.replace("n", "ny");
}
if (Math.floor(Math.random() * 2) == 1) {
element.replace("s", "sh");
if (Math.floor(Math.random() * 2) === 1) {
w.replace("s", "sh");
}
if (Math.floor(Math.random() * 5) == 3 && !isowo) {
element = element[0] + "-" + element[0] + "-" + element;
if (Math.floor(Math.random() * 5) === 3 && !owofied) {
w = w[0] + "-" + w[0] + "-" + w;
}
if (Math.floor(Math.random() * 5) == 3) {
element =
element +
if (Math.floor(Math.random() * 5) === 3) {
w =
w +
" " +
endings[Math.floor(Math.random() * endings.length)];
}
element = element.replace("r", "w").replace("l", "w");
return element;
w = w.replaceAll("r", "w").replaceAll("l", "w");
return w;
}).join(" ");
}
//actual command declaration
// actual command declaration
export default definePlugin({
name: "UwUifier",
description: "Simply uwuify commands",

@ -25,7 +25,7 @@ export function lazyWebpack<T = any>(filter: FilterFn): T {
has: (_, prop) => prop in getMod(),
apply: (_, $this, args) => (getMod() as Function).apply($this, args),
ownKeys: () => Reflect.ownKeys(getMod()),
construct: (_, args, newTarget) => new newTarget(...args),
construct: (_, args, newTarget) => Reflect.construct(getMod(), args, newTarget),
deleteProperty: (_, prop) => delete getMod()[prop],
defineProperty: (_, property, attributes) => !!Object.defineProperty(getMod(), property, attributes)
}) as T;

Loading…
Cancel
Save