aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-10-12 22:22:37 +0200
committerVendicated <vendicated@riseup.net>2022-10-12 22:22:37 +0200
commit8817e2dff71f4736f4f8c9011457d20e63ec4ca3 (patch)
tree27bcbbbd86210cfcaa518831ed7e456c2c769762 /src
parent267b2b1a0703313311da01addafcee28100347ea (diff)
downloadVencord-8817e2dff71f4736f4f8c9011457d20e63ec4ca3.tar.gz
Vencord-8817e2dff71f4736f4f8c9011457d20e63ec4ca3.tar.bz2
Vencord-8817e2dff71f4736f4f8c9011457d20e63ec4ca3.zip
Reorganise command plugins
Diffstat (limited to 'src')
-rw-r--r--src/plugins/echo.ts23
-rw-r--r--src/plugins/lenny.ts20
-rw-r--r--src/plugins/moreCommands.ts37
-rw-r--r--src/plugins/petpet.ts8
-rw-r--r--src/plugins/uwuify.ts35
5 files changed, 50 insertions, 73 deletions
diff --git a/src/plugins/echo.ts b/src/plugins/echo.ts
deleted file mode 100644
index 9e79800..0000000
--- a/src/plugins/echo.ts
+++ /dev/null
@@ -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 });
- },
- },
- ]
-});
diff --git a/src/plugins/lenny.ts b/src/plugins/lenny.ts
deleted file mode 100644
index 1877752..0000000
--- a/src/plugins/lenny.ts
+++ /dev/null
@@ -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", "") + " ( ͡° ͜ʖ ͡°)"
- }),
- },
- ]
-});
diff --git a/src/plugins/moreCommands.ts b/src/plugins/moreCommands.ts
new file mode 100644
index 0000000..91c1abb
--- /dev/null
+++ b/src/plugins/moreCommands.ts
@@ -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", "") + " ( ͡° ͜ʖ ͡°)"
+ }),
+ },
+ ]
+});
diff --git a/src/plugins/petpet.ts b/src/plugins/petpet.ts
index 6b0fd4f..0c4c29b 100644
--- a/src/plugins/petpet.ts
+++ b/src/plugins/petpet.ts
@@ -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));
- }),
+ },
},
]
});
diff --git a/src/plugins/uwuify.ts b/src/plugins/uwuify.ts
index 8c8d790..2cf0f76 100644
--- a/src/plugins/uwuify.ts
+++ b/src/plugins/uwuify.ts
@@ -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: [