From cb617a8ed7701f43480491abbb57129281a30b00 Mon Sep 17 00:00:00 2001 From: splatter Date: Sun, 19 Jan 2025 16:53:44 +0000 Subject: [PATCH] add common issues --- index.ts | 69 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/index.ts b/index.ts index a620f56..bfdc55a 100644 --- a/index.ts +++ b/index.ts @@ -11,11 +11,12 @@ import { sendMessage } from "@utils/discord"; import definePlugin, { Plugin } from "@utils/types"; import { GuildMemberStore, UserStore } from "@webpack/common"; -import plugins, { PluginMeta } from "~plugins"; +import { PluginMeta } from "~plugins"; -import SettingsPlugin from "../../plugins/_core/settings"; -import { isPluginDev } from "@utils/misc"; +import { isPluginDev, tryOrElse } from "@utils/misc"; import { findByCodeLazy } from "@webpack"; +import { getUserSettingLazy } from "../../api/UserSettings.js"; +import SettingsPlugin from "../../plugins/_core/settings"; const clientVersion = () => { const version = IS_DISCORD_DESKTOP ? DiscordNative.app.getVersion() : IS_VESKTOP ? VesktopNative.app.getVersion() : null; @@ -26,28 +27,30 @@ const clientVersion = () => { }; const lines = `\ -VV VV - VV VV - VV VV - VV VV - VVV - CCCCCCC - CC - CC - CC - CCCCCCC\ +\n\ +\tVV VV +\t VV VV +\t VV VV +\t VV VV +\t VVV +\t CCCCCCC +\t CC +\t CC +\t CC +\t CCCCCCC\ `.split("\n"); const sanitised = `\ -VV VV - VV VV - VV VV - VV VV - VVV - CCCCCCC - CC - CC - CC - CCCCCCC\ +\n\ +\tVV VV +\t VV VV +\t VV VV +\t VV VV +\t VVV +\t CCCCCCC +\t CC +\t CC +\t CC +\t CCCCCCC\ `.split("\n"); // ```ansi @@ -120,6 +123,8 @@ function humanFileSize(bytes, si = false, dp = 1) { } const getVersions = findByCodeLazy("logsUploaded:new Date().toISOString(),"); +const ShowCurrentGame = getUserSettingLazy("status", "showCurrentGame")!; + export default definePlugin({ name: "venfetch", @@ -131,12 +136,20 @@ export default definePlugin({ description: "neofetch for vencord", inputType: ApplicationCommandInputType.BUILT_IN, execute: (args: Argument[], ctx: CommandContext) => { + const commonIssues = { + "NoRPC": Vencord.Plugins.isPluginEnabled("NoRPC"), + "disabled activities": tryOrElse(() => !ShowCurrentGame.getSetting(), false), + "outdated": BUILD_TIMESTAMP < Date.now() - 12096e5, + "likes java": ['287555395151593473', '886685857560539176', "728342296696979526"].includes(UserStore.getCurrentUser().id), + }; + const { username } = UserStore.getCurrentUser(); const versions = getVersions(); const info: Record = { - version: `${VERSION} ~ ${gitHash}${SettingsPlugin.additionalInfo} - ${Intl.DateTimeFormat(navigator.language, { dateStyle: "medium" }).format(BUILD_TIMESTAMP)}`, + version: `${VERSION} ~ ${gitHash}${SettingsPlugin.additionalInfo} - ${Intl.DateTimeFormat(navigator.language, { dateStyle: "medium" }).format(BUILD_TIMESTAMP)}${!IS_STANDALONE ? ` ~ dev` : ""}`, client: `${t(window.GLOBAL_ENV.RELEASE_CHANNEL)} ~ ${clientVersion()}`, 'Build Number': `${versions.buildNumber} ~ Hash: ${versions.versionHash?.slice(0, 7) ?? 'unknown'}`, + issues: Object.entries(commonIssues).filter(([_, value]) => value).map(([key]) => key).join(", ") || '', _: null, @@ -144,7 +157,7 @@ export default definePlugin({ platform: navigator.userAgentData?.platform ? `${navigator.userAgentData?.platform} (${navigator.platform})` : navigator.platform, plugins: getEnabledPlugins(), uptime: `${~~((Date.now() - window.GLOBAL_ENV.HTML_TIMESTAMP) / 1000)}s`, - // TODO: pr to vencord real and add to vencordnative + // TODO: add to native.ts // memory: `${humanFileSize(VencordNative.memoryUsage().heapUsed)} / ${humanFileSize(VencordNative.memoryUsage().heapTotal)}`, __: null, @@ -159,7 +172,7 @@ export default definePlugin({ // electron web context, want to get total memory usage }; - const computed: [string, string | null][] = Object.entries(info).map(([key, value]) => [key, value]); + const computed: [string, string | null][] = Object.entries(info).filter(([key, value]) => value === null || value!.length).map(([key, value]) => [key, value]); let str = ""; @@ -171,10 +184,10 @@ export default definePlugin({ if (lines[i]) { str += `${lines[i]}`; - if (line && line[1] !== null && line[0] !== "__COLOR_TEST__") str += `${" ".repeat(25 - sanitised[i].length)}${t(line[0])}: ${line[1]}\n`; + if (line && line[1] !== null && line[0] !== "__COLOR_TEST__") str += `${" ".repeat(22 - sanitised[i].length)}${t(line[0])}: ${line[1]}\n`; else if (line[0] === "__COLOR_TEST__") str += line[0] + "\n"; else str += "\n"; } else { - if (line && line[1] !== null && line[0] !== "__COLOR_TEST__") str += `${" ".repeat(25)}${t(line[0])}: ${line[1]}\n`; + if (line && line[1] !== null && line[0] !== "__COLOR_TEST__") str += `\t${" ".repeat(22)}${t(line[0])}: ${line[1]}\n`; else if (line[0] === "__COLOR_TEST__") str += `${" ".repeat(25)}${line[1]}\n`; else str += "\n"; } }