diff --git a/README.md b/README.md index 5cc3148c..23b87800 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - Request for plugins from Discord.
-Extra included plugins (119 additional plugins) +Extra included plugins (120 additional plugins) - AllCallTimers by MaxHerbold and D3SOX - AltKrispSwitch by newwares @@ -80,6 +80,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - InRole by nin0dev - IrcColors by Grzesiek11 - IRememberYou by zoodogood +- Jumpscare by Joona - JumpToStart by Samwich - KeyboardSounds by HypedDomi - KeywordNotify by camila314 (maintained by thororen) @@ -90,7 +91,6 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - MessageLoggerEnhanced by Aria - MessageTranslate by Samwich - ModalFade by Kyuuhachi -- MusicTitleRPC by Blackilykay - NewPluginsManager by Sqaaakoi - noAppsAllowed by kvba - NoBulletPoints by Samwich @@ -130,6 +130,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - Translate+ by Prince527 (Using Translate by Ven) - UnitConverter by sadan - UnlimitedAccounts by thororen +- UnreadCountBadge by Joona - UserPFP by nexpid (maintained by thororen) - UwUifier by echo - VCSupport by thororen diff --git a/src/equicordplugins/jumpscare/index.tsx b/src/equicordplugins/jumpscare/index.tsx new file mode 100644 index 00000000..bfddd14d --- /dev/null +++ b/src/equicordplugins/jumpscare/index.tsx @@ -0,0 +1,95 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import "./styles.css"; + +import { definePluginSettings } from "@api/Settings"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { FluxDispatcher, ReactDOM, useEffect, useState } from "@webpack/common"; +import { Root } from "react-dom/client"; + +let jumpscareRoot: Root | undefined; + +const settings = definePluginSettings({ + imageSource: { + type: OptionType.STRING, + description: "Sets the image url of the jumpscare", + default: "https://github.com/Equicord/Equibored/blob/main/misc/troll.gif?raw=true" + }, + audioSource: { + type: OptionType.STRING, + description: "Sets the audio url of the jumpscare", + default: "https://github.com/Equicord/Equibored/raw/main/misc/trollolol.mp3?raw=true" + }, + chance: { + type: OptionType.NUMBER, + description: "The chance of a jumpscare happening (1 in X so: 100 = 1/100 or 1%, 50 = 1/50 or 2%, etc.)", + default: 1000 + } +}); + +function getJumpscareRoot(): Root { + if (!jumpscareRoot) { + const element = document.createElement("div"); + element.id = "jumpscare-root"; + element.classList.add("jumpscare-root"); + document.body.append(element); + jumpscareRoot = ReactDOM.createRoot(element); + } + + return jumpscareRoot; +} + +export default definePlugin({ + name: "Jumpscare", + description: "Adds a configurable chance of jumpscaring you whenever you open a channel. Inspired by Geometry Dash Mega Hack", + authors: [Devs.surgedevs], + settings, + + start() { + getJumpscareRoot().render( + + ); + }, + + stop() { + jumpscareRoot?.unmount(); + jumpscareRoot = undefined; + }, + + JumpscareComponent() { + const [isPlaying, setIsPlaying] = useState(false); + + const audio = new Audio(settings.store.audioSource); + + const jumpscare = event => { + if (isPlaying) return; + + const chance = 1 / settings.store.chance; + if (Math.random() > chance) return; + + setIsPlaying(true); + audio.play(); + + console.log(isPlaying); + + setTimeout(() => { + setIsPlaying(false); + }, 1000); + }; + + useEffect(() => { + FluxDispatcher.subscribe("CHANNEL_SELECT", jumpscare); + + return () => { + FluxDispatcher.unsubscribe("CHANNEL_SELECT", jumpscare); + }; + }); + + return ; + } +}); diff --git a/src/equicordplugins/jumpscare/styles.css b/src/equicordplugins/jumpscare/styles.css new file mode 100644 index 00000000..3bfd50c3 --- /dev/null +++ b/src/equicordplugins/jumpscare/styles.css @@ -0,0 +1,33 @@ +.jumpscare-root { + pointer-events: none; +} + +.jumpscare-img { + position: absolute; + width: 100%; + height: 100%; + background-color: #000; + z-index: 99999; + object-fit: contain; + opacity: 0; +} + +.jumpscare-animate { + animation: jumpscare-animation 0.7s; +} + +@keyframes jumpscare-animation { + 0% { + transform: scale(0); + } + + 80% { + transform: scale(1); + opacity: 1; + } + + 100% { + transform: scale(0); + opacity: 0; + } +} diff --git a/src/equicordplugins/unreadBadgeCount/index.tsx b/src/equicordplugins/unreadBadgeCount/index.tsx new file mode 100644 index 00000000..20a7736f --- /dev/null +++ b/src/equicordplugins/unreadBadgeCount/index.tsx @@ -0,0 +1,36 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import ErrorBoundary from "@components/ErrorBoundary"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { findByPropsLazy } from "@webpack"; +import { ReadStateStore, useStateFromStores } from "@webpack/common"; +const { NumberBadge } = findByPropsLazy("NumberBadge"); + +import "./styles.css"; + +export default definePlugin({ + name: "UnreadCountBadge", + authors: [Devs.Joona], + description: "Show unread count in the channel list", + patches: [ + // Kanged from typingindicators + { + find: "UNREAD_IMPORTANT:", + replacement: { + match: /\.name\),.{0,120}\.children.+?:null(?<=,channel:(\i).+?)/, + replace: "$&,$self.CountBadge({channelId:$1.id})" + } + }, + ], + + CountBadge: ErrorBoundary.wrap(({ channelId }: { channelId: string; }) => { + const unreadCount = useStateFromStores([ReadStateStore], () => ReadStateStore.getUnreadCount(channelId)); + if (!unreadCount) return null; + return ; + }, { noop: true }) +}); diff --git a/src/equicordplugins/unreadBadgeCount/styles.css b/src/equicordplugins/unreadBadgeCount/styles.css new file mode 100644 index 00000000..793d089e --- /dev/null +++ b/src/equicordplugins/unreadBadgeCount/styles.css @@ -0,0 +1,7 @@ +.unreadCountBadge { + margin-left: 4px; +} + +[class*="modeMuted_"] .unreadCountBadge { + display: none; +}