fix merge conflict
This commit is contained in:
commit
f095065fd5
1 changed files with 32 additions and 17 deletions
49
index.ts
49
index.ts
|
@ -15,6 +15,7 @@ import plugins, { PluginMeta } from "~plugins";
|
|||
|
||||
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;
|
||||
|
@ -65,22 +66,28 @@ VV VV
|
|||
const isApiPlugin = (plugin: Plugin) => plugin.name.endsWith("API") || plugin.required;
|
||||
|
||||
function getEnabledPlugins() {
|
||||
let counter = 0;
|
||||
let total = 0;
|
||||
let userpluginsCount = 0;
|
||||
let totalUserplugins = 0;
|
||||
const counters = {
|
||||
official: {
|
||||
enabled: 0,
|
||||
total: 0
|
||||
},
|
||||
user: {
|
||||
enabled: 0,
|
||||
total: 0
|
||||
}
|
||||
};
|
||||
|
||||
Object.values(plugins).filter((plugin) => !isApiPlugin(plugin)).forEach((plugin) => {
|
||||
if (PluginMeta[plugin.name].userPlugin) {
|
||||
if (plugin.started) userpluginsCount++;
|
||||
totalUserplugins++;
|
||||
Object.values(Vencord.Plugins.plugins).filter((plugin) => !isApiPlugin(plugin)).forEach((plugin) => {
|
||||
if (PluginMeta[plugin.name]?.userPlugin) {
|
||||
if (plugin.started) counters.user.enabled++;
|
||||
counters.user.total++;
|
||||
} else {
|
||||
if (plugin.started) counter++;
|
||||
total++;
|
||||
};
|
||||
if (plugin.started) counters.official.enabled++;
|
||||
counters.official.total++;
|
||||
}
|
||||
});
|
||||
|
||||
return `${counter}/${total} (official)` + (totalUserplugins ? `, ${userpluginsCount}/${totalUserplugins} (userplugins)` : "");
|
||||
return `${counters.official.enabled} / ${counters.official.total} (official)` + (counters.user.total ? `, ${counters.user.enabled} / ${counters.user.total} (userplugins)` : "");
|
||||
}
|
||||
function getDonorStatus() {
|
||||
return GuildMemberStore.getMember("1015060230222131221", UserStore.getCurrentUser().id).roles.includes("1042507929485586532");
|
||||
|
@ -112,6 +119,8 @@ function humanFileSize(bytes, si = false, dp = 1) {
|
|||
return bytes.toFixed(dp) + " " + units[u];
|
||||
}
|
||||
|
||||
const getVersions = findByCodeLazy("logsUploaded:new Date().toISOString(),");
|
||||
|
||||
export default definePlugin({
|
||||
name: "venfetch",
|
||||
description: "neofetch for vencord",
|
||||
|
@ -123,22 +132,28 @@ export default definePlugin({
|
|||
inputType: ApplicationCommandInputType.BUILT_IN,
|
||||
execute: (args: Argument[], ctx: CommandContext) => {
|
||||
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)}`,
|
||||
client: `${t(window.GLOBAL_ENV.RELEASE_CHANNEL)} ~ ${clientVersion()}`,
|
||||
'Build Number': `${versions.buildNumber} ~ Hash: ${versions.versionHash?.slice(0, 7) ?? 'unknown'}`,
|
||||
|
||||
_: null,
|
||||
|
||||
// @ts-ignore
|
||||
platform: navigator.userAgentData?.platform ?? navigator.platform,
|
||||
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
|
||||
// memory: `${humanFileSize(VencordNative.memoryUsage().heapUsed)} / ${humanFileSize(VencordNative.memoryUsage().heapTotal)}`,
|
||||
_: null,
|
||||
|
||||
donor: getDonorStatus() ? "yes" : "no",
|
||||
contributor: getContribStatus() ? "yes" : null,
|
||||
|
||||
__: null,
|
||||
|
||||
donor: getDonorStatus() ? "yes" : "no",
|
||||
contributor: getContribStatus() ? "yes" : "no",
|
||||
|
||||
___: null,
|
||||
|
||||
__COLOR_TEST__: "[2;40m[2;30m███[0m[2;40m[0m[2;31m[0m[2;30m███[0m[2;31m███[0m[2;32m███[0m[2;33m███[0m[2;34m███[0m[2;35m███[0m[2;36m███[0m[2;37m███[0m"
|
||||
|
||||
// electron web context, want to get total memory usage
|
||||
|
|
Loading…
Reference in a new issue