diff --git a/README.md b/README.md index b6643c23..47f3723c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch ### Extra included plugins
-171 additional plugins +172 additional plugins ### All Platforms @@ -143,6 +143,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - SidebarChat by Joona - Signature by Ven, Rini, ImBanana, KrystalSkull - Slap by Korbo +- Soggy by sliwka - SoundBoardLogger by Moxxie, fres, echo, maintained by thororen - SplitLargeMessages by Reycko - SpotifyActivityToggle by thororen diff --git a/src/equicordplugins/soggy/index.tsx b/src/equicordplugins/soggy/index.tsx new file mode 100644 index 00000000..9f730724 --- /dev/null +++ b/src/equicordplugins/soggy/index.tsx @@ -0,0 +1,150 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2025 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { definePluginSettings } from "@api/Settings"; +import ErrorBoundary from "@components/ErrorBoundary"; +import { EquicordDevs } from "@utils/constants"; +import { ModalProps, ModalRoot, openModal } from "@utils/modal"; +import definePlugin, { OptionType } from "@utils/types"; +import { findComponentByCodeLazy } from "@webpack"; +import { React } from "@webpack/common"; + +const HeaderBarIcon = findComponentByCodeLazy(".HEADER_BAR_BADGE_TOP:", '.iconBadge,"top"'); + +function SoggyModal(props: ModalProps) { + if (settings.store.enableSong) { + React.useEffect(() => { + const song = document.createElement("audio"); + song.src = settings.store.songLink; + song.play(); + + return () => { + song.pause(); + song.remove(); + }; + }, []); + } + + const boop = (e: React.MouseEvent) => { + const img = e.currentTarget; + const { offsetX, offsetY } = e.nativeEvent; + + const region = { x: 155, y: 220, width: 70, height: 70 }; + + if ( + settings.store.enableBoop && + offsetX >= region.x && + offsetX <= region.x + region.width && + offsetY >= region.y && + offsetY <= region.y + region.height + ) { + const boopSound = new Audio(settings.store.boopLink); + boopSound.play(); + } + }; + + return ( + + + + ); +} + +function buildSoggyModal(): any { + openModal(props => ); +} + +function SoggyButton() { + return ( + ( + + )} + onClick={() => buildSoggyModal()} + selected={false} + /> + ); +} + +const settings = definePluginSettings({ + enableSong: { + description: "Enable the song that plays after clicking the button", + type: OptionType.BOOLEAN, + default: true, + }, + enableBoop: { + description: "Let's you boop soggy's nose", + type: OptionType.BOOLEAN, + default: true, + }, + tooltipText: { + description: "The text shown when hovering over the button", + type: OptionType.STRING, + default: "the soggy", + }, + imageLink: { + description: "URL for the image (button and modal)", + type: OptionType.STRING, + default: "https://soggy.cat/img/soggycat.webp", + }, + songLink: { + description: "URL for the song to play", + type: OptionType.STRING, + default: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Sneaky%20Snitch.mp3", + }, + boopLink: { + description: "URL for the boop sound", + type: OptionType.STRING, + default: "https://github.com/Capeling/soggy-mod/raw/refs/heads/main/resources/honk.wav", + } +}); + +export default definePlugin({ + name: "Soggy", + description: "Adds a soggy button to the toolbox", + authors: [EquicordDevs.sliwka], + settings, + patches: [ + { + find: "toolbar:function", + replacement: { + match: /(function \i\(\i\){)(.{1,200}toolbar.{1,450}mobileToolbar)/, + replace: "$1$self.addIconToToolBar(arguments[0]);$2" + } + } + ], + + // taken from message logger lol + addIconToToolBar(e: { toolbar: React.ReactNode[] | React.ReactNode; }) { + if (Array.isArray(e.toolbar)) + return e.toolbar.push( + + + + ); + + e.toolbar = [ + + + , + e.toolbar, + ]; + }, +}); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index aee354e5..03aee3ec 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1070,6 +1070,10 @@ export const EquicordDevs = Object.freeze({ name: "Cootshk", id: 921605971577548820n, }, + sliwka: { + name: "sliwka", + id: 1165286199628419129n, + }, } satisfies Record); // iife so #__PURE__ works correctly