From f6e702cbae7376448909bb47fd29ab92108b732c Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Mon, 17 Mar 2025 01:42:20 -0400 Subject: [PATCH] RandomVoice --- README.md | 4 +- src/equicordplugins/randomVoice/index.tsx | 721 ++++++++++++++++++++++ src/utils/constants.ts | 4 + 3 files changed, 728 insertions(+), 1 deletion(-) create mode 100644 src/equicordplugins/randomVoice/index.tsx diff --git a/README.md b/README.md index 9aa98887..e4fc5ada 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch ### Extra included plugins
-157 additional plugins +159 additional plugins ### All Platforms - AllCallTimers by MaxHerbold & D3SOX @@ -64,6 +64,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - GensokyoRadioRPC by RyanCaoDev & Prince527 - GifCollections by Aria & Creations - GifRoulette by Samwich +- GitHubRepos by talhakf - Glide by Samwich - GlobalBadges by HypedDomi & Hosted by Wolfie - GoogleThat by Samwich @@ -115,6 +116,7 @@ You can join our [discord server](https://discord.gg/5Xh2W87egW) for commits, ch - QuestCompleter by Amia - QuestionMarkReplacement by nyx - Quoter by Samwich +- RandomVoice by omaw - Remix by MrDiamond - RemixMe by kvba - RepeatMessage by Tolgchu diff --git a/src/equicordplugins/randomVoice/index.tsx b/src/equicordplugins/randomVoice/index.tsx new file mode 100644 index 00000000..74e18099 --- /dev/null +++ b/src/equicordplugins/randomVoice/index.tsx @@ -0,0 +1,721 @@ +/* + * 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 { makeRange } from "@components/PluginSettings/components"; +import { debounce } from "@shared/debounce"; +import { EquicordDevs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; +import { ChannelStore, ContextMenuApi, GuildStore, Menu, NavigationRouter, PermissionStore, React, SelectedChannelStore, Toasts, UserStore } from "@webpack/common"; + +const ChatVoiceIcon = findComponentByCodeLazy("22H12Zm2-5.26c0"); +const Button = findComponentByCodeLazy(".NONE,disabled:", ".PANEL_BUTTON"); +const VoiceStateStore = findStoreLazy("VoiceStateStore"); +const MediaEngineStore = findStoreLazy("MediaEngineStore"); +const ChannelActions = findByPropsLazy("selectChannel", "selectVoiceChannel"); +const { toggleSelfMute } = findByPropsLazy("toggleSelfMute"); +const { toggleSelfDeaf } = findByPropsLazy("toggleSelfDeaf"); +const valueOperation = [ + { label: "More than", value: "<", default: false }, + { label: "Less than", value: ">", default: false }, + { label: "Equal to", value: "==", default: true }, +]; + +const CONNECT = 1n << 20n; +const SPEAK = 1n << 21n; +const STREAM = 1n << 9n; + +const settings = definePluginSettings({ + UserAmountOperation: { + description: "Select an operation for the amounts of users", + type: OptionType.SELECT, + options: [...valueOperation], + }, + UserAmount: { + description: "Select amount of users", + type: OptionType.SLIDER, + markers: makeRange(0, 15, 1), + default: 3, + stickToMarkers: true, + }, + spacesLeftOperation: { + description: "Select an operation for the maximum amounts of users", + type: OptionType.SELECT, + options: [...valueOperation], + }, + spacesLeft: { + description: "Select amount of max users", + type: OptionType.SLIDER, + markers: makeRange(0, 15, 1), + default: 3, + stickToMarkers: true, + }, + vcLimitOperation: { + description: "Select an operation for the voice-channel.", + type: OptionType.SELECT, + options: [...valueOperation], + }, + vcLimit: { + description: "Select a voice-channel limit", + type: OptionType.SLIDER, + markers: makeRange(1, 15, 1), + default: 5, + stickToMarkers: true, + }, + Servers: { + description: "Servers that are included", + type: OptionType.STRING, + default: "", + }, + autoNavigate: { + type: OptionType.BOOLEAN, + description: "Automatically navigates to the voice-channel.", + default: false, + }, + autoCamera: { + type: OptionType.BOOLEAN, + description: "Automatically turns on camera", + default: false, + }, + selfMute: { + type: OptionType.BOOLEAN, + description: "Automatically mutes your mic when joining voice-channel.", + default: false, + }, + selfDeafen: { + type: OptionType.BOOLEAN, + description: "Automatically deafems your mic when joining voice-channel.", + default: false, + }, + avoidStages: { + type: OptionType.BOOLEAN, + description: "Avoids joining stage voice-channels.", + default: false, + }, + avoidAfk: { + type: OptionType.BOOLEAN, + description: "Avoids joining AFK voice-channels.", + default: false, + }, + video: { + type: OptionType.BOOLEAN, + description: "Searches for users with their video on", + default: false, + }, + stream: { + type: OptionType.BOOLEAN, + description: "Searches for users who are streaming", + default: false, + }, + mute: { + type: OptionType.BOOLEAN, + description: "Searches for users who are muted", + default: false, + }, + deafen: { + type: OptionType.BOOLEAN, + description: "Searches for users who are deafened", + default: false, + }, + includeStates: { + type: OptionType.BOOLEAN, + description: "Option to include states", + default: false, + }, + avoidStates: { + type: OptionType.BOOLEAN, + description: "Option to avoid states", + default: false, + }, +}); + + +export default definePlugin({ + name: "RandomVoice", + description: "Adds a Button near the Mute button to join a random voice call.", + authors: [EquicordDevs.omaw], + patches: [ + { + find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}", + replacement: { + match: /className:\i\.buttons,.{0,60}children:\[/, + replace: "$&$self.randomVoice()," + } + } + ], + settings, + randomVoice: ErrorBoundary.wrap(randomVoice, { noop: true }), +}); + +function randomVoice() { + return ( + <> +