Reorganise command plugins

This commit is contained in:
Vendicated 2022-10-12 22:22:37 +02:00
parent 267b2b1a07
commit 8817e2dff7
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
5 changed files with 50 additions and 73 deletions

View file

@ -1,23 +0,0 @@
import definePlugin from "../utils/types";
import { ApplicationCommandInputType, sendBotMessage, findOption, OptionalMessageOption } from "../api/Commands";
import { ReactionEmoji, Message, MessageReaction, JSMessage } from "discord-types/general";
export default definePlugin({
name: "Echo",
description: "Uses Clydes message function to send a custom message of your choice (locally)",
authors: [{ name: "ICodeInAssembly", id: 702973430449832038n }],
dependencies: ["CommandsAPI"],
commands: [
{
name: "echo",
description: "Sends a message as Clyde (locally)",
options: [OptionalMessageOption],
inputType: ApplicationCommandInputType.BOT,
execute: (opts, ctx) => {
const message = findOption(opts, "message", "");
sendBotMessage(ctx.channel.id, { content: message });
},
},
]
});

View file

@ -1,20 +0,0 @@
import definePlugin from "../utils/types";
import { Devs } from "../utils/constants";
import { findOption, OptionalMessageOption } from "../api/Commands";
export default definePlugin({
name: "lenny",
description: "( ͡° ͜ʖ ͡°)",
authors: [Devs.Arjix],
dependencies: ["CommandsAPI"],
commands: [
{
name: "lenny",
description: "Sends a lenny face",
options: [OptionalMessageOption],
execute: opts => ({
content: findOption(opts, "message", "") + " ( ͡° ͜ʖ ͡°)"
}),
},
]
});

View file

@ -0,0 +1,37 @@
import definePlugin from "../utils/types";
import { ApplicationCommandInputType, sendBotMessage, findOption, OptionalMessageOption } from "../api/Commands";
import { Devs } from "../utils/constants";
export default definePlugin({
name: "MoreCommands",
description: "echo, lenny",
authors: [
Devs.Arjix,
{
name: "ICodeInAssembly",
id: 702973430449832038n
}
],
dependencies: ["CommandsAPI"],
commands: [
{
name: "echo",
description: "Sends a message as Clyde (locally)",
options: [OptionalMessageOption],
inputType: ApplicationCommandInputType.BOT,
execute: (opts, ctx) => {
const content = findOption(opts, "message", "");
sendBotMessage(ctx.channel.id, { content });
},
},
{
name: "lenny",
description: "Sends a lenny face",
options: [OptionalMessageOption],
execute: opts => ({
content: findOption(opts, "message", "") + " ( ͡° ͜ʖ ͡°)"
}),
},
]
});

View file

@ -1,7 +1,7 @@
import { ApplicationCommandOptionType, findOption, ApplicationCommandInputType, Argument, CommandContext } from "../api/Commands";
import { Devs } from "../utils/constants";
import definePlugin from "../utils/types";
import { lazy, lazyWebpack, suppressErrors } from "../utils/misc";
import { lazy, lazyWebpack } from "../utils/misc";
import { filters } from "../webpack";
const DRAFT_TYPE = 0;
@ -36,7 +36,7 @@ function loadImage(source: File | string) {
URL.revokeObjectURL(url);
resolve(img);
};
img.onerror = reject;
img.onerror = (event, _source, _lineno, _colno, err) => reject(err || event);
img.crossOrigin = "Anonymous";
img.src = url;
});
@ -109,7 +109,7 @@ export default definePlugin({
type: ApplicationCommandOptionType.BOOLEAN
}
],
execute: suppressErrors("petpetExecute", async (opts, cmdCtx) => {
execute: async (opts, cmdCtx) => {
const { GIFEncoder, quantize, applyPalette } = await getGifEncoder();
const frames = await getFrames();
@ -162,7 +162,7 @@ export default definePlugin({
// Immediately after the command finishes, Discord clears all input, including pending attachments.
// Thus, setImmediate is needed to make this execute after Discord cleared the input
setImmediate(() => promptToUpload([file], cmdCtx.channel, DRAFT_TYPE));
}),
},
},
]
});

View file

@ -1,32 +1,13 @@
import definePlugin from "../utils/types";
import { findOption, RequiredMessageOption } from "../api/Commands";
// words have a chance of ending with these
const endings = [
"owo",
"UwU",
">w<",
"^w^",
"●w●",
"☆w☆",
"𝗨𝘄𝗨",
"(ᗒᗨᗕ)",
"(▰˘v˘▰)",
"( ´ ▽ ` ).。o♡",
"*unbuttons shirt*",
">3<",
">:3",
":3",
"murr~",
"♥(。U ω U。)",
"(˘ε˘)",
"*screams*",
"*twerks*",
"*sweats*",
"owo", "UwU", ">w<", "^w^", "●w●", "☆w☆", "𝗨𝘄𝗨", "(ᗒᗨᗕ)", "(▰˘v˘▰)",
"( ´ ▽ ` ).。o♡", "*unbuttons shirt*", ">3<", ">:3", ":3", "murr~",
"♥(。U ω U。)", "(˘ε˘)", "*screams*", "*twerks*", "*sweats*",
];
// replacement words
const words = [
const replacements = [
["love", "wuv"],
["mr", "mistuh"],
["dog", "doggo"],
@ -45,7 +26,6 @@ const words = [
];
// uwuify command
function uwuify(message: string): string {
return message
.split(" ")
@ -58,7 +38,7 @@ function uwuify(message: string): string {
}
// replacing the words based on the array on line 29
for (let [find, replace] of words) {
for (let [find, replace] of replacements) {
if (w.includes(find)) {
w = w.replace(find, replace);
owofied = true;
@ -111,7 +91,10 @@ function uwuify(message: string): string {
export default definePlugin({
name: "UwUifier",
description: "Simply uwuify commands",
authors: [{ name: "ECHO", id: 712639419785412668n }],
authors: [{
name: "ECHO",
id: 712639419785412668n
}],
dependencies: ["CommandsAPI"],
commands: [