mirror of
https://github.com/Equicord/Equicord.git
synced 2025-04-01 13:11:57 -04:00
Add files via upload
This commit is contained in:
parent
e13ac1ef84
commit
7b0c9f2d5d
2 changed files with 158 additions and 130 deletions
|
@ -3,17 +3,18 @@
|
||||||
* 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, ContextMenuApi, GuildStore, Menu, NavigationRouter, PermissionStore, React, SelectedChannelStore, Toasts, UserStore } from "@webpack/common";
|
import { ChannelStore, RelationshipStore, SelectedChannelStore, ContextMenuApi, GuildStore, Menu, PermissionStore, React, 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");
|
||||||
|
@ -143,7 +144,7 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
|
find: "#{intl::ACCOUNT_SPEAKING_WHILE_MUTED}",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /className:\i\.buttons,.{0,60}children:\[/,
|
match: /className:\i\.buttons,.{0,50}children:\[/,
|
||||||
replace: "$&$self.randomVoice(),"
|
replace: "$&$self.randomVoice(),"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,7 +152,6 @@ 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="18"
|
width="20"
|
||||||
height="18"
|
height="20"
|
||||||
id="test"
|
id="test"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
>
|
>
|
||||||
|
@ -174,7 +174,6 @@ function randomVoice() {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ContextMenu() {
|
function ContextMenu() {
|
||||||
let ServerList: any[] = [];
|
let ServerList: any[] = [];
|
||||||
Object.values(UserStore.getUsers()).forEach(user => {
|
Object.values(UserStore.getUsers()).forEach(user => {
|
||||||
|
@ -203,13 +202,13 @@ function ContextMenu() {
|
||||||
const [stream, setStream] = React.useState(settings.store.stream);
|
const [stream, setStream] = React.useState(settings.store.stream);
|
||||||
const [state, setState] = React.useState(settings.store.includeStates);
|
const [state, setState] = React.useState(settings.store.includeStates);
|
||||||
const [notstate, avoidState] = React.useState(settings.store.avoidStates);
|
const [notstate, avoidState] = React.useState(settings.store.avoidStates);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu.Menu
|
<Menu.Menu
|
||||||
navId="random-vc"
|
navId="random-vc"
|
||||||
onClose={() => { }}
|
onClose={() => { }}
|
||||||
aria-label="Voice state modifier"
|
aria-label="Voice state modifier"
|
||||||
>
|
>
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
id="servers"
|
id="servers"
|
||||||
label="Select Servers"
|
label="Select Servers"
|
||||||
|
@ -223,21 +222,21 @@ function ContextMenu() {
|
||||||
label={server?.name ?? "invalid server"}
|
label={server?.name ?? "invalid server"}
|
||||||
checked={servers.includes(server?.id ?? "invalid server")}
|
checked={servers.includes(server?.id ?? "invalid server")}
|
||||||
action={() => {
|
action={() => {
|
||||||
if (settings.store.Servers.includes(server?.id ?? "invalid server"))
|
if (settings.store.Servers.includes(server?.id ?? "invalid server"))
|
||||||
settings.store.Servers = settings.store.Servers.replace(`/${server.id}`, "");
|
settings.store.Servers = settings.store.Servers.replace(`/${server.id}`, "");
|
||||||
else
|
else
|
||||||
settings.store.Servers += `/${server?.id ?? "invalid server"}`;
|
settings.store.Servers += `/${server?.id ?? "invalid server"}`;
|
||||||
setServers(settings.store.Servers);
|
setServers(settings.store.Servers);
|
||||||
}} />
|
}} />
|
||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
id="selectAll"
|
id="selectAll"
|
||||||
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}
|
||||||
|
@ -253,6 +252,8 @@ function ContextMenu() {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
id="clear list "
|
id="clear list "
|
||||||
label="Reset List"
|
label="Reset List"
|
||||||
|
@ -285,72 +286,74 @@ function ContextMenu() {
|
||||||
</Menu.MenuItem>
|
</Menu.MenuItem>
|
||||||
|
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
id="Filter states"
|
id="Filter states"
|
||||||
label="Select Filters"
|
label="Select Filters"
|
||||||
action={() => { }} >
|
action={() => { }} >
|
||||||
<>
|
<>
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="muted"
|
key="muted"
|
||||||
id="muted"
|
id="muted"
|
||||||
label="Muted"
|
label="Muted"
|
||||||
action={() => {
|
action={() => {
|
||||||
setMute(!mute);
|
setMute(!mute);
|
||||||
settings.store.mute = !mute;
|
settings.store.mute = !mute;
|
||||||
}}
|
}}
|
||||||
checked={mute} />
|
checked={mute} />
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="deafen"
|
key="deafen"
|
||||||
id="deafen"
|
id="deafen"
|
||||||
label="Deafened"
|
label="Deafened"
|
||||||
action={() => {
|
action={() => {
|
||||||
setDeafen(!deafen);
|
setDeafen(!deafen);
|
||||||
settings.store.deafen = !deafen;
|
settings.store.deafen = !deafen;
|
||||||
}}
|
}}
|
||||||
checked={deafen} />
|
checked={deafen} />
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="video"
|
key="video"
|
||||||
id="video"
|
id="video"
|
||||||
label="Video"
|
label="Video"
|
||||||
action={() => {
|
action={() => {
|
||||||
setVideo(!video);
|
setVideo(!video);
|
||||||
settings.store.video = !video;
|
settings.store.video = !video;
|
||||||
}}
|
}}
|
||||||
checked={video} />
|
checked={video} />
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="stream"
|
key="stream"
|
||||||
id="stream"
|
id="stream"
|
||||||
label="Stream"
|
label="Stream"
|
||||||
action={() => {
|
action={() => {
|
||||||
setStream(!stream);
|
setStream(!stream);
|
||||||
settings.store.stream = !stream;
|
settings.store.stream = !stream;
|
||||||
}}
|
}}
|
||||||
checked={stream} />
|
checked={stream} />
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="state"
|
key="state"
|
||||||
id="state"
|
id="state"
|
||||||
label="Include Filters"
|
label="Include Filters"
|
||||||
disabled={settings.store.avoidStates || !settings.store.includeStates && !settings.store.mute && !settings.store.deafen && !settings.store.video && !settings.store.stream}
|
disabled={settings.store.avoidStates || !settings.store.includeStates && !settings.store.mute && !settings.store.deafen && !settings.store.video && !settings.store.stream}
|
||||||
action={() => {
|
action={() => {
|
||||||
setState(!state);
|
setState(!state);
|
||||||
settings.store.includeStates = !state;
|
settings.store.includeStates = !state;
|
||||||
}}
|
}}
|
||||||
checked={state} />
|
checked={state} />
|
||||||
|
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="notstate"
|
key="notstate"
|
||||||
id="notstate"
|
id="notstate"
|
||||||
label="Avoid Filters"
|
label="Avoid Filters"
|
||||||
disabled={settings.store.includeStates || !settings.store.avoidStates && !settings.store.avoidStates && !settings.store.mute && !settings.store.deafen && !settings.store.video && !settings.store.stream}
|
disabled={settings.store.includeStates || !settings.store.avoidStates && !settings.store.avoidStates && !settings.store.mute && !settings.store.deafen && !settings.store.video && !settings.store.stream}
|
||||||
action={() => {
|
action={() => {
|
||||||
avoidState(!notstate);
|
avoidState(!notstate);
|
||||||
settings.store.avoidStates = !notstate;
|
settings.store.avoidStates = !notstate;
|
||||||
}}
|
}}
|
||||||
checked={notstate} />
|
checked={notstate} />
|
||||||
</>
|
</>
|
||||||
</Menu.MenuItem>
|
</Menu.MenuItem>
|
||||||
|
|
||||||
<Menu.MenuSeparator />
|
|
||||||
|
|
||||||
|
<Menu.MenuSeparator />
|
||||||
|
|
||||||
<Menu.MenuGroup
|
<Menu.MenuGroup
|
||||||
label="USER AMOUNT"
|
label="USER AMOUNT"
|
||||||
>
|
>
|
||||||
|
@ -409,15 +412,18 @@ function ContextMenu() {
|
||||||
</>
|
</>
|
||||||
</Menu.MenuItem>
|
</Menu.MenuItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Menu.MenuGroup>
|
</Menu.MenuGroup>
|
||||||
|
|
||||||
<Menu.MenuSeparator />
|
<Menu.MenuSeparator />
|
||||||
|
|
||||||
<Menu.MenuGroup
|
<Menu.MenuGroup
|
||||||
label="SPACES LEFT"
|
label="SPACES LEFT"
|
||||||
>
|
>
|
||||||
|
|
||||||
<Menu.MenuControlItem
|
<Menu.MenuControlItem
|
||||||
id="max-user"
|
id="max-user"
|
||||||
label="Spaces Left"
|
label="Spaces Left"
|
||||||
control={(props, ref) => (
|
control={(props, ref) => (
|
||||||
|
@ -433,7 +439,7 @@ function ContextMenu() {
|
||||||
renderValue={(value: number) => `${value.toFixed(0)} user${Number(value.toFixed(0)) === 1 ? "" : "s"}`} />
|
renderValue={(value: number) => `${value.toFixed(0)} user${Number(value.toFixed(0)) === 1 ? "" : "s"}`} />
|
||||||
)} />
|
)} />
|
||||||
|
|
||||||
<Menu.MenuItem
|
<Menu.MenuItem
|
||||||
id="maxGroup"
|
id="maxGroup"
|
||||||
label="Parameters"
|
label="Parameters"
|
||||||
action={() => { }} >
|
action={() => { }} >
|
||||||
|
@ -470,6 +476,9 @@ function ContextMenu() {
|
||||||
}} />
|
}} />
|
||||||
</>
|
</>
|
||||||
</Menu.MenuItem>
|
</Menu.MenuItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Menu.MenuGroup >
|
</Menu.MenuGroup >
|
||||||
|
|
||||||
|
@ -477,7 +486,7 @@ function ContextMenu() {
|
||||||
|
|
||||||
<Menu.MenuGroup
|
<Menu.MenuGroup
|
||||||
label="Voice LIMIT"
|
label="Voice LIMIT"
|
||||||
>
|
>
|
||||||
|
|
||||||
<Menu.MenuControlItem
|
<Menu.MenuControlItem
|
||||||
id="vc-limit"
|
id="vc-limit"
|
||||||
|
@ -534,41 +543,41 @@ function ContextMenu() {
|
||||||
</Menu.MenuItem>
|
</Menu.MenuItem>
|
||||||
|
|
||||||
</Menu.MenuGroup>
|
</Menu.MenuGroup>
|
||||||
|
|
||||||
<Menu.MenuSeparator />
|
<Menu.MenuSeparator />
|
||||||
<Menu.MenuGroup
|
<Menu.MenuGroup
|
||||||
label="SETTINGS"
|
label="SETTINGS"
|
||||||
>
|
>
|
||||||
<Menu.MenuItem id="voiceOptions" label="Voice Options" action={() => { }} >
|
<Menu.MenuItem id="voiceOptions" label="Voice Options" action={() => { }} >
|
||||||
<>
|
<>
|
||||||
{ }
|
{}
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="selfMute"
|
key="selfMute"
|
||||||
id="selfMute"
|
id="selfMute"
|
||||||
label="Auto Mute"
|
label="Auto Mute"
|
||||||
action={() => {
|
action={() => {
|
||||||
setSelfMute(!muteself);
|
setSelfMute(!muteself);
|
||||||
settings.store.selfMute = !muteself;
|
settings.store.selfMute = !muteself;
|
||||||
}}
|
}}
|
||||||
checked={muteself} />
|
checked={muteself} />
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="selfDeafen"
|
key="selfDeafen"
|
||||||
id="selfDeafen"
|
id="selfDeafen"
|
||||||
label="Auto Deafen"
|
label="Auto Deafen"
|
||||||
action={() => {
|
action={() => {
|
||||||
setSelfDeafen(!deafenself);
|
setSelfDeafen(!deafenself);
|
||||||
settings.store.selfDeafen = !deafenself;
|
settings.store.selfDeafen = !deafenself;
|
||||||
}}
|
}}
|
||||||
checked={deafenself} />
|
checked={deafenself} />
|
||||||
<Menu.MenuCheckboxItem
|
<Menu.MenuCheckboxItem
|
||||||
key="autoCamera"
|
key="autoCamera"
|
||||||
id="autoCamera"
|
id="autoCamera"
|
||||||
label="Auto Camera"
|
label="Auto Camera"
|
||||||
action={() => {
|
action={() => {
|
||||||
setCamera(!camera);
|
setCamera(!camera);
|
||||||
settings.store.autoCamera = !camera;
|
settings.store.autoCamera = !camera;
|
||||||
}}
|
}}
|
||||||
checked={camera} />
|
checked={camera} />
|
||||||
</>
|
</>
|
||||||
</Menu.MenuItem>
|
</Menu.MenuItem>
|
||||||
|
|
||||||
|
@ -582,7 +591,10 @@ function ContextMenu() {
|
||||||
}}
|
}}
|
||||||
checked={navigate} />
|
checked={navigate} />
|
||||||
|
|
||||||
<Menu.MenuCheckboxItem
|
|
||||||
|
|
||||||
|
|
||||||
|
<Menu.MenuCheckboxItem
|
||||||
key="avoidStage"
|
key="avoidStage"
|
||||||
id="avoidStage"
|
id="avoidStage"
|
||||||
label="Avoid Stage"
|
label="Avoid Stage"
|
||||||
|
@ -601,12 +613,11 @@ function ContextMenu() {
|
||||||
settings.store.avoidAfk = !afk;
|
settings.store.avoidAfk = !afk;
|
||||||
}}
|
}}
|
||||||
checked={afk} />
|
checked={afk} />
|
||||||
|
|
||||||
</Menu.MenuGroup>
|
</Menu.MenuGroup>
|
||||||
</Menu.Menu>
|
</Menu.Menu>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChannels() {
|
function getChannels() {
|
||||||
const criteriaChannel: any[] = [];
|
const criteriaChannel: any[] = [];
|
||||||
|
|
||||||
|
@ -619,9 +630,9 @@ function getChannels() {
|
||||||
const channel = ChannelStore.getChannel(channelId);
|
const channel = ChannelStore.getChannel(channelId);
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
const channelVoiceStates = VoiceStateStore.getVoiceStatesForChannel(channelId);
|
const channelVoiceStates = VoiceStateStore.getVoiceStatesForChannel(channelId);
|
||||||
|
|
||||||
if (!settings.store.Servers.split("/").includes(channel.getGuildId())) return;
|
if (!settings.store.Servers.split("/").includes(channel.getGuildId())) return;
|
||||||
if (settings.store.avoidStages && channel.isGuildStageVoice()) return;
|
if (settings.store.avoidStages && channel.isGuildStageVoice()) return;
|
||||||
const operations = {
|
const operations = {
|
||||||
">": (a, b) => a < b,
|
">": (a, b) => a < b,
|
||||||
"<": (a, b) => a > b,
|
"<": (a, b) => a > b,
|
||||||
|
@ -645,31 +656,31 @@ 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++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -692,19 +703,32 @@ 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) NavigationRouter.transitionTo(channel.guild_id, channel.id);
|
if (settings.store.autoNavigate) autoNavigate(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(() => {
|
||||||
|
|
4
src/equicordplugins/randomVoice/styles.css
Normal file
4
src/equicordplugins/randomVoice/styles.css
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
.buttons__37e49 {
|
||||||
|
width: 5px;
|
||||||
|
margin-left: -13px;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue