From f2216b0dcf19fc0928dc3c34271c6f5f456a77c6 Mon Sep 17 00:00:00 2001 From: kmmiio99o Date: Tue, 30 Sep 2025 14:59:59 +0200 Subject: [PATCH] Found fix? --- plugins/Commands/src/commands/firstmessage.ts | 25 ++----------------- plugins/Commands/src/commands/lists.ts | 18 ++++++------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/plugins/Commands/src/commands/firstmessage.ts b/plugins/Commands/src/commands/firstmessage.ts index 542f9db..6aee255 100644 --- a/plugins/Commands/src/commands/firstmessage.ts +++ b/plugins/Commands/src/commands/firstmessage.ts @@ -1,15 +1,8 @@ import { findByProps } from "@vendetta/metro"; import { url } from "@vendetta/metro/common"; -import { validateChannelForCommand } from "../utils/messages"; const APIUtils = findByProps("getAPIBaseURL", "get"); const MessageActions = findByProps("sendMessage"); -const messageUtil = findByProps("sendBotMessage", "sendMessage", "receiveMessage"); - -// Generate consistent nonce -const generateNonce = () => { - return (BigInt(Date.now()) * BigInt(4194304) + BigInt(Math.floor(Math.random() * 4194304))).toString(); -}; // Helper functions for fetching messages const getFirstGuildMessage = async ( @@ -71,20 +64,6 @@ export const firstMessageCommand = { }, ], execute: async (args: any, ctx: any) => { - // Special handling for threads/forum channels - if (ctx.channel.type >= 10 && ctx.channel.type <= 15) { - return { - type: 4, - data: { - content: "FirstMessage command doesn't work in thread or forum channels.", - flags: 64 - } - }; - } - - const channelValidation = validateChannelForCommand(ctx); - if (channelValidation) return channelValidation; - try { const options = new Map(args.map((option: any) => [option.name, option])); const user = options.get("user")?.value; @@ -132,12 +111,12 @@ export const firstMessageCommand = { } if (send) { - const nonce = generateNonce(); + const fixNonce = Date.now().toString(); MessageActions.sendMessage( ctx.channel.id, { content: result }, void 0, - { nonce } + { nonce: fixNonce } ); return { type: 4 }; } else { diff --git a/plugins/Commands/src/commands/lists.ts b/plugins/Commands/src/commands/lists.ts index d237d5b..7db641a 100644 --- a/plugins/Commands/src/commands/lists.ts +++ b/plugins/Commands/src/commands/lists.ts @@ -44,7 +44,7 @@ const addonAuthors = (authors: any) => { if (!authors) return "Unknown"; if (!Array.isArray(authors)) return "Unknown"; if (authors.length === 0) return "Unknown"; - + return authors .filter(author => author && (typeof author === 'string' || (typeof author === 'object' && author.name))) .map(author => typeof author === 'string' ? author : (author.name || "Unknown")) @@ -61,7 +61,7 @@ const getListLength = (list: string[]) => formatList(list).length; const sendList = async (channelID: string, list: string[]) => { // Use consistent nonce generation const nonce = (BigInt(Date.now()) * BigInt(4194304) + BigInt(Math.floor(Math.random() * 4194304))).toString(); - + await MessageActions.sendMessage(channelID, { content: formatList(list) }, void 0, { nonce }); @@ -88,7 +88,7 @@ export async function themeList(args: any[], ctx: CommandContext) { } const objectValues = Object.values(themes); - + const channelID: string = ctx.channel.id; const themeList = baseListHeader('Theme', Object.keys(themes).length); @@ -96,14 +96,14 @@ export async function themeList(args: any[], ctx: CommandContext) { if (objectValues.length) { for (const theme of objectValues) { if (!theme || typeof theme !== 'object') continue; - + const { selected, data, id } = theme; - + // Safe destructuring with fallbacks const name = data?.name || "Unknown Theme"; const description = data?.description || "No description"; const authors = data?.authors; - + if (detailed || alwaysDetailed) themeList.push( `> **Name**: ${name}`, @@ -133,7 +133,7 @@ export async function themeList(args: any[], ctx: CommandContext) { cancelText: ALERT.CANCEL, onConfirm: async () => await sendList(channelID, themeList) }); - + await sendList(channelID, themeList); } } catch (error) { @@ -162,9 +162,9 @@ export async function pluginList(args: any[], ctx: CommandContext) { for (const plugin of Object.values(plugins)) { if (!plugin || typeof plugin !== 'object') continue; - + const { enabled, manifest, id } = plugin; - + // Safe destructuring with fallbacks const name = manifest?.name || "Unknown Plugin"; const description = manifest?.description || "No description";