From 892a79b2a7c21d04aafdf8de54a117fb7522c2c0 Mon Sep 17 00:00:00 2001 From: redstonekasi Date: Wed, 25 Oct 2023 16:16:16 +0200 Subject: [PATCH] fix: CommandsAPI --- src/api/Commands/commandHelpers.ts | 6 +++--- src/plugins/_api/commands.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/Commands/commandHelpers.ts b/src/api/Commands/commandHelpers.ts index dd1196f9f..2fd189032 100644 --- a/src/api/Commands/commandHelpers.ts +++ b/src/api/Commands/commandHelpers.ts @@ -17,14 +17,14 @@ */ import { mergeDefaults } from "@utils/misc"; -import { findByCodeLazy, findByPropsLazy } from "@webpack"; +import { findByPropsLazy } from "@webpack"; import { SnowflakeUtils } from "@webpack/common"; import { Message } from "discord-types/general"; import type { PartialDeep } from "type-fest"; import { Argument } from "./types"; -const createBotMessage = findByCodeLazy('username:"Clyde"'); +const MessageCreator = findByPropsLazy("createBotMessage"); const MessageSender = findByPropsLazy("receiveMessage"); export function generateId() { @@ -38,7 +38,7 @@ export function generateId() { * @returns {Message} */ export function sendBotMessage(channelId: string, message: PartialDeep): Message { - const botMessage = createBotMessage({ channelId, content: "", embeds: [] }); + const botMessage = MessageCreator.createBotMessage({ channelId, content: "", embeds: [] }); MessageSender.receiveMessage(channelId, mergeDefaults(message, botMessage)); diff --git a/src/plugins/_api/commands.ts b/src/plugins/_api/commands.ts index b7d6ef9fe..3a7619365 100644 --- a/src/plugins/_api/commands.ts +++ b/src/plugins/_api/commands.ts @@ -44,8 +44,8 @@ export default definePlugin({ find: "Unexpected value for option", replacement: { // return [2, cmd.execute(args, ctx)] - match: /,(.{1,2})\.execute\((.{1,2}),(.{1,2})\)]/, - replace: (_, cmd, args, ctx) => `,Vencord.Api.Commands._handleCommand(${cmd}, ${args}, ${ctx})]` + match: /,(\i)\.execute\((\i),(\i)\)/, + replace: (_, cmd, args, ctx) => `,Vencord.Api.Commands._handleCommand(${cmd}, ${args}, ${ctx})` } }, // Show plugin name instead of "Built-In"