mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-24 22:07:03 -04:00
ShowMeYourName Extra Settings & Fix WhosWatching
This commit is contained in:
parent
0d09c083c6
commit
efd1821fad
3 changed files with 53 additions and 24 deletions
|
@ -11,8 +11,8 @@ 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, findByCode, findByProps } from "@webpack";
|
||||
import { ChannelStore, ContextMenuApi, GuildStore, IconUtils, Menu, ChannelRouter, PermissionStore, React, SelectedChannelStore, PermissionsBits, Toasts, UserStore } from "@webpack/common";
|
||||
import { findByCode, findByProps, findByPropsLazy, findComponentByCodeLazy, findStoreLazy } from "@webpack";
|
||||
import { ChannelRouter, ChannelStore, ContextMenuApi, GuildStore, Menu, PermissionsBits, PermissionStore, React, SelectedChannelStore, Toasts, UserStore } from "@webpack/common";
|
||||
|
||||
import style from "./styles.css?managed";
|
||||
|
||||
|
@ -86,10 +86,10 @@ const settings = definePluginSettings({
|
|||
description: "Automatically turns on camera",
|
||||
default: false,
|
||||
},
|
||||
autoStream: {
|
||||
type: OptionType.BOOLEAN,
|
||||
autoStream: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Automatically turns on stream",
|
||||
default: false,
|
||||
default: false,
|
||||
},
|
||||
selfMute: {
|
||||
type: OptionType.BOOLEAN,
|
||||
|
@ -101,10 +101,10 @@ const settings = definePluginSettings({
|
|||
description: "Automatically deafems your mic when joining voice-channel.",
|
||||
default: false,
|
||||
},
|
||||
leaveEmpty: {
|
||||
leaveEmpty: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Finds a random-call, when the voice chat is empty.",
|
||||
default: false,
|
||||
default: false,
|
||||
},
|
||||
avoidStages: {
|
||||
type: OptionType.BOOLEAN,
|
||||
|
@ -177,21 +177,21 @@ export default definePlugin({
|
|||
}
|
||||
],
|
||||
flux: {
|
||||
VOICE_STATE_UPDATES({ voiceStates }: { voiceStates: VoiceState[] }) {
|
||||
VOICE_STATE_UPDATES({ voiceStates }: { voiceStates: VoiceState[]; }) {
|
||||
const currentUserId = UserStore.getCurrentUser().id;
|
||||
const myChannelId = VoiceStateStore.getVoiceStateForUser(currentUserId)?.channelId;
|
||||
if (!myChannelId || !settings.store.leaveEmpty) return;
|
||||
|
||||
|
||||
const voiceStatesMap = VoiceStateStore.getVoiceStates() as Record<string, VoiceState>;
|
||||
const othersInChannel = Object.values(voiceStatesMap).filter(vs =>
|
||||
vs.channelId === myChannelId && vs.userId !== currentUserId
|
||||
);
|
||||
|
||||
|
||||
if (othersInChannel.length === 0) {
|
||||
randomVoice()
|
||||
randomVoice();
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
start() {
|
||||
enableStyle(style);
|
||||
},
|
||||
|
@ -261,7 +261,7 @@ function ContextMenu() {
|
|||
aria-label="Voice state modifier"
|
||||
>
|
||||
|
||||
|
||||
|
||||
<Menu.MenuItem
|
||||
id="servers"
|
||||
label="Select Servers"
|
||||
|
|
|
@ -82,10 +82,9 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
{
|
||||
predicate: () => settings.store.showPanel,
|
||||
find: "this.renderEmbeddedActivity()",
|
||||
replacement: {
|
||||
match: /(?<=children.{0,50})"div"(?=.{0,500}this\.renderEmbeddedActivity\(\))/,
|
||||
match: /(?<=render\(\).{0,500}children.{0,50})"div"(?=.{0,500}this\.renderEmbeddedActivity\(\))/,
|
||||
replace: "$self.WrapperComponent"
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +117,7 @@ export default definePlugin({
|
|||
return (
|
||||
<>
|
||||
<div {...props}>{props.children}</div>
|
||||
<div className={classes(cl("spectators_panel"), Margins.top8)} style={{ marginLeft: 8 }}>
|
||||
<div className={classes(cl("spectators_panel"), Margins.top8)}>
|
||||
<Forms.FormTitle tag="h3" style={{ marginTop: 8, marginBottom: 0, textTransform: "uppercase" }}>
|
||||
{getIntlMessage("SPECTATORS", { numViewers: userIds.length })}
|
||||
</Forms.FormTitle>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue