From 08491081e560e03b776e88ab734708570fe1f724 Mon Sep 17 00:00:00 2001 From: nin0dev Date: Fri, 25 Oct 2024 17:46:10 -0400 Subject: [PATCH] a --- index.ts | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 index.ts diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..1194eac --- /dev/null +++ b/index.ts @@ -0,0 +1,98 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { ApplicationCommandInputType, Argument, CommandContext } from "@api/Commands"; +import { gitHash } from "@shared/vencordUserAgent"; +import { Devs } from "@utils/constants"; +import { sendMessage } from "@utils/discord"; +import definePlugin from "@utils/types"; +import { GuildMemberStore, UserStore } from "@webpack/common"; + +import SettingsPlugin from "../../plugins/_core/settings"; + +const client = (() => { + if (IS_DISCORD_DESKTOP) return `Discord Desktop v${DiscordNative.app.getVersion()}`; + if (IS_VESKTOP) return `Vesktop v${VesktopNative.app.getVersion()}`; + if ("legcord" in window) return `Legcord v${window.legcord.version}`; + + // @ts-expect-error + const name = typeof unsafeWindow !== "undefined" ? "UserScript" : "Web"; + return `${name} (${navigator.userAgent})`; +})(); +let uptime = 0; + +const line1 = "```ansi"; +// Placeholders: %username% +const line2 = "VV VV %username%"; +const line3 = " VV VV ---------------"; +// Placeholders: %ver% +const line4 = " VV VV Version: %ver%"; +// Placeholders: %client% +const line5 = " VV VV Client: %client%"; +// Placeholders: %platform% +const line6 = " VVV Platform: %platform%"; +// Placeholders: %pluginCount% +const line7 = " CCCCCCC Plugin Count: %pluginCount%"; +// Placeholders: %uptime% +const line8 = " CC Uptime: %uptime%"; +// Placeholders: %donorStatus% +const line9 = " CC Donor: %donorStatus%"; +const line10 = " CC"; +const line11 = " CCCCCCC ███████████████████████████"; +const line12 = "```"; + +function getEnabledPlugins() { + let counter = 0; + Object.entries(Vencord.Plugins.plugins).forEach(([key, value]) => { + if (value.started) counter++; + }); + return counter.toString(); +} +function getDonorStatus() { + return GuildMemberStore.getMember("1015060230222131221", UserStore.getCurrentUser().id).roles.includes("1042507929485586532"); +} + +export default definePlugin({ + name: "venfetch", + description: "neofetch for vencord", + authors: [Devs.nin0dev], + start() { + setInterval(() => { + uptime++; + }, 1000); + }, + commands: [ + { + name: "venfetch", + description: "neofetch for vencord", + inputType: ApplicationCommandInputType.BUILT_IN, + execute: (args: Argument[], ctx: CommandContext) => { + const { username } = UserStore.getCurrentUser(); + const info = { + Vencord: + `v${VERSION} • ${gitHash}` + + `${SettingsPlugin.additionalInfo} - ${Intl.DateTimeFormat("en-GB", { dateStyle: "medium" }).format(BUILD_TIMESTAMP)}`, + Client: `${window.GLOBAL_ENV.RELEASE_CHANNEL} ~ ${client}`, + Platform: window.navigator.platform + }; + sendMessage(ctx.channel.id, { + content: `${line1} +${line2.replace("%username%", username)} +${line3}\n${line4.replace("%ver%", info.Vencord)} +${line5.replace("%client%", info.Client)} +${line6.replace("%platform%", info.Platform)} +${line7.replace("%pluginCount%", getEnabledPlugins())} +${line8.replace("%uptime%", `${uptime}s`)} +${line9.replace("%donorStatus%", getDonorStatus() ? "yes" : "no")} +${line10} +${line11} +${line12}` + }); + return; + } + } + ] +});