Compare commits
No commits in common. "main" and "guh" have entirely different histories.
1 changed files with 28 additions and 41 deletions
69
index.ts
69
index.ts
|
@ -11,12 +11,11 @@ import { sendMessage } from "@utils/discord";
|
|||
import definePlugin, { Plugin } from "@utils/types";
|
||||
import { GuildMemberStore, UserStore } from "@webpack/common";
|
||||
|
||||
import { PluginMeta } from "~plugins";
|
||||
import plugins, { PluginMeta } from "~plugins";
|
||||
|
||||
import { isPluginDev, tryOrElse } from "@utils/misc";
|
||||
import { findByCodeLazy } from "@webpack";
|
||||
import { getUserSettingLazy } from "../../api/UserSettings.js";
|
||||
import SettingsPlugin from "../../plugins/_core/settings";
|
||||
import { isPluginDev } from "@utils/misc";
|
||||
import { findByCodeLazy } from "@webpack";
|
||||
|
||||
const clientVersion = () => {
|
||||
const version = IS_DISCORD_DESKTOP ? DiscordNative.app.getVersion() : IS_VESKTOP ? VesktopNative.app.getVersion() : null;
|
||||
|
@ -27,30 +26,28 @@ const clientVersion = () => {
|
|||
};
|
||||
|
||||
const lines = `\
|
||||
\n\
|
||||
\tVV VV
|
||||
\t VV VV
|
||||
\t VV VV
|
||||
\t VV VV
|
||||
\t VVV
|
||||
\t [2;35mCCCCCCC
|
||||
\t [2;35mCC
|
||||
\t [2;35mCC
|
||||
\t [2;35mCC
|
||||
\t [2;35mCCCCCCC[0m\
|
||||
VV VV
|
||||
VV VV
|
||||
VV VV
|
||||
VV VV
|
||||
VVV
|
||||
[2;35mCCCCCCC
|
||||
[2;35mCC
|
||||
[2;35mCC
|
||||
[2;35mCC
|
||||
[2;35mCCCCCCC[0m\
|
||||
`.split("\n");
|
||||
const sanitised = `\
|
||||
\n\
|
||||
\tVV VV
|
||||
\t VV VV
|
||||
\t VV VV
|
||||
\t VV VV
|
||||
\t VVV
|
||||
\t CCCCCCC
|
||||
\t CC
|
||||
\t CC
|
||||
\t CC
|
||||
\t CCCCCCC\
|
||||
VV VV
|
||||
VV VV
|
||||
VV VV
|
||||
VV VV
|
||||
VVV
|
||||
CCCCCCC
|
||||
CC
|
||||
CC
|
||||
CC
|
||||
CCCCCCC\
|
||||
`.split("\n");
|
||||
|
||||
// ```ansi
|
||||
|
@ -123,8 +120,6 @@ 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",
|
||||
|
@ -136,20 +131,12 @@ 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)}${!IS_STANDALONE ? ` ~ dev` : ""}`,
|
||||
version: `${VERSION} ~ ${gitHash}${SettingsPlugin.additionalInfo} - ${Intl.DateTimeFormat(navigator.language, { dateStyle: "medium" }).format(BUILD_TIMESTAMP)}`,
|
||||
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,
|
||||
|
||||
|
@ -157,7 +144,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: add to native.ts
|
||||
// TODO: pr to vencord real and add to vencordnative
|
||||
// memory: `${humanFileSize(VencordNative.memoryUsage().heapUsed)} / ${humanFileSize(VencordNative.memoryUsage().heapTotal)}`,
|
||||
|
||||
__: null,
|
||||
|
@ -172,7 +159,7 @@ export default definePlugin({
|
|||
// electron web context, want to get total memory usage
|
||||
};
|
||||
|
||||
const computed: [string, string | null][] = Object.entries(info).filter(([key, value]) => value === null || value!.length).map(([key, value]) => [key, value]);
|
||||
const computed: [string, string | null][] = Object.entries(info).map(([key, value]) => [key, value]);
|
||||
|
||||
let str = "";
|
||||
|
||||
|
@ -184,10 +171,10 @@ export default definePlugin({
|
|||
if (lines[i]) {
|
||||
str += `${lines[i]}`;
|
||||
|
||||
if (line && line[1] !== null && line[0] !== "__COLOR_TEST__") str += `${" ".repeat(22 - sanitised[i].length)}[2;35m[0m[2;35m${t(line[0])}: [0m[0m${line[1]}[0m[2;35m[0m\n`;
|
||||
if (line && line[1] !== null && line[0] !== "__COLOR_TEST__") str += `${" ".repeat(25 - sanitised[i].length)}[2;35m[0m[2;35m${t(line[0])}: [0m[0m${line[1]}[0m[2;35m[0m\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 += `\t${" ".repeat(22)}[2;35m[0m[2;35m${t(line[0])}: [0m[0m${line[1]}[0m[2;35m[0m\n`;
|
||||
if (line && line[1] !== null && line[0] !== "__COLOR_TEST__") str += `${" ".repeat(25)}[2;35m[0m[2;35m${t(line[0])}: [0m[0m${line[1]}[0m[2;35m[0m\n`;
|
||||
else if (line[0] === "__COLOR_TEST__") str += `${" ".repeat(25)}${line[1]}\n`; else str += "\n";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue