mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-28 16:04:24 -04:00
Fix Up PR More
This commit is contained in:
parent
b59e829c5d
commit
4f25affbda
1 changed files with 22 additions and 21 deletions
|
@ -319,7 +319,6 @@ export default definePlugin({
|
|||
{ name: "toUpperCase", value: "toUpperCase", label: "toUpperCase" },
|
||||
{ name: "toLocaleLowerCase", value: "toLocaleLowerCase", label: "toLocaleLowerCase" },
|
||||
{ name: "toLocaleUpperCase", value: "toLocaleUpperCase", label: "toLocaleUpperCase" },
|
||||
{ name: "reverse", value: "reverse", label: "reverse" },
|
||||
{ name: "stay the same", value: "same", label: "stay the same" }
|
||||
]
|
||||
},
|
||||
|
@ -329,10 +328,16 @@ export default definePlugin({
|
|||
type: ApplicationCommandOptionType.INTEGER,
|
||||
required: false
|
||||
},
|
||||
{
|
||||
name: "reverse",
|
||||
description: "reverse your text",
|
||||
type: ApplicationCommandOptionType.BOOLEAN,
|
||||
required: false
|
||||
},
|
||||
{
|
||||
name: "normalize",
|
||||
description: "which normailze option to use",
|
||||
type: ApplicationCommandOptionType.INTEGER,
|
||||
type: ApplicationCommandOptionType.STRING,
|
||||
required: false,
|
||||
choices: [
|
||||
{ name: "NFC", value: "NFC", label: "NFC" },
|
||||
|
@ -343,28 +348,24 @@ export default definePlugin({
|
|||
},
|
||||
],
|
||||
execute: opts => {
|
||||
const transform = findOption(opts, "transformation") as string;
|
||||
const repeat = findOption(opts, "repeat") as number | undefined;
|
||||
const normalize = findOption(opts, "normalize") as string | undefined;
|
||||
let text = findOption(opts, "text") as string;
|
||||
const transform = findOption(opts, "transformation") as string;
|
||||
const repeat = findOption(opts, "repeat") as number | undefined ?? 1;
|
||||
const normalize = findOption(opts, "normalize") as string | undefined;
|
||||
const reverse = findOption(opts, "reverse") as string | undefined;
|
||||
|
||||
if (transform && text) {
|
||||
if (transform === "same") {
|
||||
if (normalize) text = text.normalize(normalize);
|
||||
return {
|
||||
content: text.repeat(repeat ?? 1)
|
||||
};
|
||||
} else {
|
||||
const method = (text as any)[transform];
|
||||
const transformed = method.call(text);
|
||||
if (normalize) text = text.normalize(normalize);
|
||||
if (transform === "reverse") text = text.split("").reverse().join("");
|
||||
return {
|
||||
content: transformed.repeat(repeat ?? 1)
|
||||
};
|
||||
}
|
||||
if (!transform || !text) return;
|
||||
|
||||
if (transform !== "same") {
|
||||
text = (text as any)[transform]?.call(text) ?? text;
|
||||
}
|
||||
},
|
||||
|
||||
if (normalize) text = text.normalize(normalize);
|
||||
if (reverse) text = text.split("").reverse().join("");
|
||||
|
||||
return { content: text.repeat(repeat) };
|
||||
}
|
||||
,
|
||||
},
|
||||
]
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue