add common issues

This commit is contained in:
duke dennis 2025-01-19 16:53:44 +00:00
parent f095065fd5
commit cb617a8ed7

View file

@ -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<boolean>("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<string, string | null> = {
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";
}
}