VcNarrator: only narrate events of current session

This commit is contained in:
Vendicated 2026-01-28 04:53:09 +01:00
parent 781a2f7c60
commit d86423cae3
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
2 changed files with 4 additions and 2 deletions

View file

@ -5,7 +5,7 @@ export class AuthenticationStore extends FluxStore {
* Gets the id of the current user
*/
getId(): string;
getSessionId(): string;
// This Store has a lot more methods related to everything Auth, but they really should
// not be needed, so they are not typed
}

View file

@ -22,7 +22,7 @@ import { Logger } from "@utils/Logger";
import { Margins } from "@utils/margins";
import { wordsToTitle } from "@utils/text";
import definePlugin, { ReporterTestable } from "@utils/types";
import { Button, ChannelStore, Forms, GuildMemberStore, SelectedChannelStore, SelectedGuildStore, useMemo, UserStore, VoiceStateStore } from "@webpack/common";
import { AuthenticationStore, Button, ChannelStore, Forms, GuildMemberStore, SelectedChannelStore, SelectedGuildStore, useMemo, UserStore, VoiceStateStore } from "@webpack/common";
import { ReactElement } from "react";
import { getCurrentVoice, settings } from "./settings";
@ -35,6 +35,7 @@ interface VoiceStateChangeEvent {
mute: boolean;
selfDeaf: boolean;
selfMute: boolean;
sessionId: string;
}
// Mute/Deaf for other people than you is commented out, because otherwise someone can spam it and it will be annoying
@ -170,6 +171,7 @@ export default definePlugin({
for (const state of voiceStates) {
const { userId, channelId, oldChannelId } = state;
const isMe = userId === myId;
if (isMe && state.sessionId !== AuthenticationStore.getSessionId()) continue;
if (!isMe) {
if (!myChanId) continue;
if (channelId !== myChanId && oldChannelId !== myChanId) continue;