Boo: Remove Joke Setting
This commit is contained in:
parent
12aac9c8b4
commit
cfadaab08d
3 changed files with 1 additions and 132 deletions
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2025 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { createAudioPlayer } from "@api/AudioPlayer";
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import { React } from "@webpack/common";
|
||||
|
||||
const cl = classNameFactory("vc-boo-");
|
||||
|
||||
// GitHub raw URLs for hosted assets (from Equibored repository)
|
||||
const JUMPSCARE_IMAGE_URL = "https://raw.githubusercontent.com/Equicord/Equibored/03e4650cc71591796d60c40d6105c31fce9bb481/icons/boo/job.png";
|
||||
const JUMPSCARE_SOUND_URL = "https://raw.githubusercontent.com/Equicord/Equibored/03e4650cc71591796d60c40d6105c31fce9bb481/sounds/boo/vine-boom.mp3";
|
||||
|
||||
interface JumpscareOverlayProps {
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export function JumpscareOverlay({ onClose }: JumpscareOverlayProps) {
|
||||
const audioPlayer = React.useRef(createAudioPlayer(JUMPSCARE_SOUND_URL, { volume: 100 }));
|
||||
const [isClosing, setIsClosing] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
try {
|
||||
audioPlayer.current?.play();
|
||||
} catch (err) {
|
||||
console.error("Failed to play jumpscare sound:", err); // scarier than a job application
|
||||
}
|
||||
|
||||
const timer = setTimeout(() => {
|
||||
startClosing();
|
||||
}, 3000);
|
||||
|
||||
return () => {
|
||||
clearTimeout(timer);
|
||||
audioPlayer.current?.stop();
|
||||
};
|
||||
}, [onClose]);
|
||||
|
||||
const startClosing = () => {
|
||||
setIsClosing(true);
|
||||
setTimeout(() => {
|
||||
onClose();
|
||||
}, 500);
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
audioPlayer.current?.stop();
|
||||
startClosing();
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
onClick={handleClick}
|
||||
className={cl("jumpscare-overlay")}
|
||||
style={{
|
||||
animation: isClosing
|
||||
? "boo-jumpscare-fade-out 0.5s ease-out forwards"
|
||||
: "boo-jumpscare-fade 0.2s ease-in forwards"
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={JUMPSCARE_IMAGE_URL}
|
||||
alt="Jumpscare"
|
||||
className={cl("jumpscare-image")}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -19,47 +19,9 @@ import { ChannelStore, MessageStore, Tooltip, useEffect, UserStore, useState } f
|
|||
import { Boo, clearChannelFromGhost, getBooCount, getGhostedChannels, onBooCountChange } from "./Boo";
|
||||
import { GhostedUsersModal } from "./GhostedUsersModal";
|
||||
import { IconGhost } from "./IconGhost";
|
||||
import { JumpscareOverlay } from "./JumpscareOverlay";
|
||||
|
||||
export const cl = classNameFactory("vc-boo-");
|
||||
|
||||
let jumpscareTimerId: NodeJS.Timeout | null = null;
|
||||
let showJumpscareOverlay = false;
|
||||
const jumpscareCallbacks: Set<() => void> = new Set();
|
||||
|
||||
function triggerJumpscare() {
|
||||
showJumpscareOverlay = true;
|
||||
for (const callback of jumpscareCallbacks) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
function closeJumpscare() {
|
||||
showJumpscareOverlay = false;
|
||||
for (const callback of jumpscareCallbacks) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
function resetJumpscareTimer() {
|
||||
if (jumpscareTimerId) {
|
||||
clearTimeout(jumpscareTimerId);
|
||||
jumpscareTimerId = null;
|
||||
}
|
||||
|
||||
const count = getBooCount();
|
||||
if (count > 0 && settings.store.scary) {
|
||||
// this is such a bad way to do this LMFAO
|
||||
const milliseconds = 60 * 60 * 1000;
|
||||
|
||||
jumpscareTimerId = setTimeout(() => {
|
||||
if (getBooCount() > 0) {
|
||||
triggerJumpscare();
|
||||
}
|
||||
}, milliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
showIndicator: {
|
||||
type: OptionType.BOOLEAN,
|
||||
|
|
@ -79,12 +41,6 @@ export const settings = definePluginSettings({
|
|||
default: "",
|
||||
restartNeeded: false
|
||||
},
|
||||
scary: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Something might happen if you ignore someone for too long...",
|
||||
default: false,
|
||||
restartNeeded: false
|
||||
},
|
||||
ignoreBots: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Ignore DMs from bots",
|
||||
|
|
@ -120,25 +76,10 @@ function BooIndicator() {
|
|||
useEffect(() => {
|
||||
const unsubscribe = onBooCountChange(newCount => {
|
||||
setCount(newCount);
|
||||
resetJumpscareTimer();
|
||||
});
|
||||
|
||||
// register jumpscare callback
|
||||
const jumpscareCallback = () => {
|
||||
setShowJumpscare(showJumpscareOverlay);
|
||||
};
|
||||
jumpscareCallbacks.add(jumpscareCallback);
|
||||
|
||||
// lucky lucky
|
||||
resetJumpscareTimer();
|
||||
|
||||
return () => {
|
||||
unsubscribe();
|
||||
jumpscareCallbacks.delete(jumpscareCallback);
|
||||
if (jumpscareTimerId) {
|
||||
clearTimeout(jumpscareTimerId);
|
||||
jumpscareTimerId = null;
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
|
@ -173,7 +114,6 @@ function BooIndicator() {
|
|||
|
||||
return (
|
||||
<>
|
||||
{showJumpscare && <JumpscareOverlay onClose={closeJumpscare} />}
|
||||
{settings.store.showIndicator && (
|
||||
<div id={cl("container")}>
|
||||
<Tooltip text={getTooltipText()} position="right">
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ export default definePlugin({
|
|||
["EquicordCloud", "equicord_cloud_panel"],
|
||||
["EquicordBackupAndRestore", "equicord_backup_restore_panel"],
|
||||
["EquicordPatchHelper", "equicord_patch_helper_panel"],
|
||||
["Equibop", "EquibopSettings", "equicord_equibop_settings_panel"],
|
||||
["EquibopSettings", "equicord_equibop_settings_panel"],
|
||||
["EquicordDiscordIcons", "equicord_icon_viewer"],
|
||||
["EquicordThemeLibrary", "equicord_theme_library"],
|
||||
["EquicordIRememberYou", "equicord_i_remember_you"],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue