Revert "Add files via upload"

This reverts commit 7b0c9f2d5d.
This commit is contained in:
thororen1234 2025-03-25 00:16:30 -04:00
parent 7b0c9f2d5d
commit 9dc706c45f
No known key found for this signature in database
2 changed files with 130 additions and 158 deletions

View file

@ -3,18 +3,17 @@
* Copyright (c) 2025 Vendicated and contributors * Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import "./styles.css";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { makeRange } from "@components/PluginSettings/components"; import { makeRange } from "@components/PluginSettings/components";
import { debounce } from "@shared/debounce"; import { debounce } from "@shared/debounce";
import { EquicordDevs } from "@utils/constants"; import { EquicordDevs } from "@utils/constants";
import { openUserProfile } from "@utils/discord";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack"; import { findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
import { ChannelStore, RelationshipStore, SelectedChannelStore, ContextMenuApi, GuildStore, Menu, PermissionStore, React, Toasts, UserStore } from "@webpack/common"; import { ChannelStore, ContextMenuApi, GuildStore, Menu, NavigationRouter, PermissionStore, React, SelectedChannelStore, Toasts, UserStore } from "@webpack/common";
const ChatVoiceIcon = findComponentByCodeLazy("22H12Zm2-5.26c0") const ChatVoiceIcon = findComponentByCodeLazy("22H12Zm2-5.26c0");
const Button = findComponentByCodeLazy(".NONE,disabled:", ".PANEL_BUTTON"); const Button = findComponentByCodeLazy(".NONE,disabled:", ".PANEL_BUTTON");
const VoiceStateStore = findStoreLazy("VoiceStateStore"); const VoiceStateStore = findStoreLazy("VoiceStateStore");
const MediaEngineStore = findStoreLazy("MediaEngineStore"); const MediaEngineStore = findStoreLazy("MediaEngineStore");
@ -144,7 +143,7 @@ export default definePlugin({
{ {
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}", find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
replacement: { replacement: {
match: /className:\i\.buttons,.{0,50}children:\[/, match: /className:\i\.buttons,.{0,60}children:\[/,
replace: "$&$self.randomVoice()," replace: "$&$self.randomVoice(),"
} }
} }
@ -152,6 +151,7 @@ export default definePlugin({
settings, settings,
randomVoice: ErrorBoundary.wrap(randomVoice, { noop: true }), randomVoice: ErrorBoundary.wrap(randomVoice, { noop: true }),
}); });
function randomVoice() { function randomVoice() {
return ( return (
<> <>
@ -161,8 +161,8 @@ function randomVoice() {
role="switch" role="switch"
tooltipText={"Random Voice"} tooltipText={"Random Voice"}
icon={<svg icon={<svg
width="20" width="18"
height="20" height="18"
id="test" id="test"
viewBox="0 0 24 24" viewBox="0 0 24 24"
> >
@ -174,6 +174,7 @@ function randomVoice() {
</> </>
); );
} }
function ContextMenu() { function ContextMenu() {
let ServerList: any[] = []; let ServerList: any[] = [];
Object.values(UserStore.getUsers()).forEach(user => { Object.values(UserStore.getUsers()).forEach(user => {
@ -236,7 +237,7 @@ function ContextMenu() {
label="Select List" label="Select List"
action={() => { action={() => {
const allServerIds = Servers.filter(server => server?.id).map(server => server.id); const allServerIds = Servers.filter(server => server?.id).map(server => server.id);
settings.store.Servers = `/${allServerIds.join('/')}`; settings.store.Servers = `/${allServerIds.join("/")}`;
setServers(settings.store.Servers); setServers(settings.store.Servers);
}} }}
disabled={servers.length === Servers.filter(server => server?.id).length} disabled={servers.length === Servers.filter(server => server?.id).length}
@ -252,8 +253,6 @@ function ContextMenu() {
}} }}
/> />
<Menu.MenuItem <Menu.MenuItem
id="clear list " id="clear list "
label="Reset List" label="Reset List"
@ -350,8 +349,6 @@ function ContextMenu() {
</> </>
</Menu.MenuItem> </Menu.MenuItem>
<Menu.MenuSeparator /> <Menu.MenuSeparator />
<Menu.MenuGroup <Menu.MenuGroup
@ -412,9 +409,6 @@ function ContextMenu() {
</> </>
</Menu.MenuItem> </Menu.MenuItem>
</Menu.MenuGroup> </Menu.MenuGroup>
<Menu.MenuSeparator /> <Menu.MenuSeparator />
@ -477,9 +471,6 @@ function ContextMenu() {
</> </>
</Menu.MenuItem> </Menu.MenuItem>
</Menu.MenuGroup > </Menu.MenuGroup >
<Menu.MenuSeparator /> <Menu.MenuSeparator />
@ -591,9 +582,6 @@ function ContextMenu() {
}} }}
checked={navigate} /> checked={navigate} />
<Menu.MenuCheckboxItem <Menu.MenuCheckboxItem
key="avoidStage" key="avoidStage"
id="avoidStage" id="avoidStage"
@ -618,6 +606,7 @@ function ContextMenu() {
</Menu.Menu> </Menu.Menu>
); );
} }
function getChannels() { function getChannels() {
const criteriaChannel: any[] = []; const criteriaChannel: any[] = [];
@ -656,10 +645,11 @@ function getChannels() {
const channelVoiceStates = VoiceStateStore.getVoiceStatesForChannel(channel.id); const channelVoiceStates = VoiceStateStore.getVoiceStatesForChannel(channel.id);
let mismatchedStates = 0; let mismatchedStates = 0;
let bestChannelId: string | null = null; let bestChannelId: string | null = null;
for (const state of Object.values(channelVoiceStates) as { selfMute?: boolean; selfDeaf?: boolean; selfVideo?: boolean; selfStream?: boolean }[]) { for (const state of Object.values(channelVoiceStates) as { selfMute?: boolean; selfDeaf?: boolean; selfVideo?: boolean; selfStream?: boolean; }[]) {
if ((settings.store.deafen && state.selfDeaf) || (!settings.store.deafen && !state.selfDeaf)) mismatchedStates++; if ((settings.store.deafen && state.selfDeaf) || (!settings.store.deafen && !state.selfDeaf)) mismatchedStates++;
if ((settings.store.video && !state.selfVideo) || (!settings.store.video && state.selfVideo)) mismatchedStates++; if ((settings.store.video && !state.selfVideo) || (!settings.store.video && state.selfVideo)) mismatchedStates++;
if ((settings.store.stream && !state.selfStream) || (!settings.store.stream && state.selfStream)) mismatchedStates++; if ((settings.store.stream && !state.selfStream) || (!settings.store.stream && state.selfStream)) mismatchedStates++;
if (!settings.store.deafen) { if (!settings.store.deafen) {
if ((settings.store.mute && state.selfMute) || (!settings.store.mute && !state.selfMute)) mismatchedStates++; if ((settings.store.mute && state.selfMute) || (!settings.store.mute && !state.selfMute)) mismatchedStates++;
} }
@ -667,7 +657,7 @@ function getChannels() {
if (mismatchedStates < lowestMismatchCount) { if (mismatchedStates < lowestMismatchCount) {
lowestMismatchCount = mismatchedStates; lowestMismatchCount = mismatchedStates;
bestChannelId = channel.id bestChannelId = channel.id;
} }
if (bestChannelId) { if (bestChannelId) {
criteriaChannel.push(channelId); criteriaChannel.push(channelId);
@ -675,12 +665,11 @@ function getChannels() {
} }
if (settings.store.includeStates && !settings.store.avoidStates) { if (settings.store.includeStates && !settings.store.avoidStates) {
if ((settings.store.deafen && !selfDeaf) || (!settings.store.deafen && selfDeaf)) return; if ((settings.store.deafen && !selfDeaf) || (!settings.store.deafen && selfDeaf)) return;
if ((settings.store.video && !selfVideo) || (!settings.store.video && selfVideo)) return; if ((settings.store.video && !selfVideo) || (!settings.store.video && selfVideo)) return;
if ((settings.store.stream && !selfStream) || (!settings.store.stream && selfStream)) return; if ((settings.store.stream && !selfStream) || (!settings.store.stream && selfStream)) return;
if (!settings.store.deafen) if (!settings.store.deafen)
if ((settings.store.mute && !selfMute) || (!settings.store.mute && selfMute)) return; if ((settings.store.mute && !selfMute) || (!settings.store.mute && selfMute)) return;
@ -703,32 +692,19 @@ function getChannels() {
const randomIndex = Math.floor(Math.random() * criteriaChannel.length); const randomIndex = Math.floor(Math.random() * criteriaChannel.length);
JoinVc(criteriaChannel[randomIndex]); JoinVc(criteriaChannel[randomIndex]);
} }
function JoinVc(channelID) { function JoinVc(channelID) {
const channel = ChannelStore.getChannel(channelID); const channel = ChannelStore.getChannel(channelID);
ChannelActions.selectVoiceChannel(channelID); ChannelActions.selectVoiceChannel(channelID);
if (settings.store.autoNavigate) autoNavigate(channel.guild_id, channel.id); if (settings.store.autoNavigate) NavigationRouter.transitionTo(channel.guild_id, channel.id);
if (settings.store.autoCamera && PermissionStore.can(STREAM, channel)) autoCamera(); if (settings.store.autoCamera && PermissionStore.can(STREAM, channel)) autoCamera();
if (settings.store.autoCamera && PermissionStore.can(STREAM, channel)) autoCamera(); if (settings.store.autoCamera && PermissionStore.can(STREAM, channel)) autoCamera();
if (settings.store.selfMute && !MediaEngineStore.isSelfMute() && SelectedChannelStore.getVoiceChannelId()) toggleSelfMute(); if (settings.store.selfMute && !MediaEngineStore.isSelfMute() && SelectedChannelStore.getVoiceChannelId()) toggleSelfMute();
if (settings.store.selfDeafen && !MediaEngineStore.isSelfDeaf() && SelectedChannelStore.getVoiceChannelId()) toggleSelfDeaf(); if (settings.store.selfDeafen && !MediaEngineStore.isSelfDeaf() && SelectedChannelStore.getVoiceChannelId()) toggleSelfDeaf();
} }
function autoNavigate(guild: string, channel: string) {
const checkExist = setInterval(() => {
const navigate = document.querySelector(`a[href="/channels/${guild}/${channel}"]`) as HTMLButtonElement;
if (navigate) {
navigate.click();
clearInterval(checkExist);
}
}, 50);
}
function autoCamera() { function autoCamera() {
const checkExist = setInterval(() => { const checkExist = setInterval(() => {

View file

@ -1,4 +0,0 @@
.buttons__37e49 {
width: 5px;
margin-left: -13px;
}