ShowMeYourName: respect streamer mode

This commit is contained in:
Vendicated 2025-09-05 03:55:38 +02:00
parent b6e96a4d3b
commit e857f6806f
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
4 changed files with 18 additions and 2 deletions

View file

@ -0,0 +1,11 @@
import { FluxStore } from "@vencord/discord-types";
export class StreamerModeStore extends FluxStore {
get autoToggle(): boolean;
get disableNotifications(): boolean;
get disableSounds(): boolean;
get enableContentProtection(): boolean;
get enabled(): boolean;
get hideInstantInvites(): boolean;
get hidePersonalInformation(): boolean;
}

View file

@ -12,6 +12,7 @@ export * from "./RelationshipStore";
export * from "./SelectedChannelStore"; export * from "./SelectedChannelStore";
export * from "./SelectedGuildStore"; export * from "./SelectedGuildStore";
export * from "./StickersStore"; export * from "./StickersStore";
export * from "./StreamerModeStore";
export * from "./ThemeStore"; export * from "./ThemeStore";
export * from "./TypingStore"; export * from "./TypingStore";
export * from "./UserProfileStore"; export * from "./UserProfileStore";

View file

@ -11,7 +11,7 @@ import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { Channel, Message, User } from "@vencord/discord-types"; import { Channel, Message, User } from "@vencord/discord-types";
import { RelationshipStore } from "@webpack/common"; import { RelationshipStore, StreamerModeStore } from "@webpack/common";
interface UsernameProps { interface UsernameProps {
author: { nick: string; authorId: string; }; author: { nick: string; authorId: string; };
@ -74,7 +74,9 @@ export default definePlugin({
const { mode, friendNicknames, displayNames, inReplies } = settings.store; const { mode, friendNicknames, displayNames, inReplies } = settings.store;
const user = userOverride ?? message.author; const user = userOverride ?? message.author;
let { username } = user; let username = StreamerModeStore.enabled
? user.username[0] + "…"
: user.username;
if (displayNames) if (displayNames)
username = user.globalName || username; username = user.globalName || username;

View file

@ -54,6 +54,7 @@ export let StickersStore: t.StickersStore;
export let ThemeStore: t.ThemeStore; export let ThemeStore: t.ThemeStore;
export let WindowStore: t.WindowStore; export let WindowStore: t.WindowStore;
export let DraftStore: t.DraftStore; export let DraftStore: t.DraftStore;
export let StreamerModeStore: t.StreamerModeStore;
/** /**
* @see jsdoc of {@link t.useStateFromStores} * @see jsdoc of {@link t.useStateFromStores}
@ -81,6 +82,7 @@ waitForStore("EmojiStore", m => EmojiStore = m);
waitForStore("StickersStore", m => StickersStore = m); waitForStore("StickersStore", m => StickersStore = m);
waitForStore("TypingStore", m => TypingStore = m); waitForStore("TypingStore", m => TypingStore = m);
waitForStore("VoiceStateStore", m => VoiceStateStore = m); waitForStore("VoiceStateStore", m => VoiceStateStore = m);
waitForStore("StreamerModeStore", m => StreamerModeStore = m);
waitForStore("ThemeStore", m => { waitForStore("ThemeStore", m => {
ThemeStore = m; ThemeStore = m;
// Importing this directly can easily cause circular imports. For this reason, use a non import access here. // Importing this directly can easily cause circular imports. For this reason, use a non import access here.