Files
discord-decomp/modules/soundboard/trackSoundPlayed.tsx
T
2026-11-01 12:12:55 +02:00

34 lines
1.8 KiB
TypeScript

// Metro module 10780 (f10781).
import RunningGameStore_native from "../game_detection/RunningGameStore.native";
import ChannelStore from "../../stores/ChannelStore";
import RTCConnectionStore from "../../stores/RTCConnectionStore";
import SelectedChannelStore from "../../stores/SelectedChannelStore";
import { DEFAULT_SOUND_GUILD_ID } from "./SoundboardConstants";
import { AnalyticEvents } from "../../Constants";
import { AnalyticsPremiumFeatureNames, AnalyticsPremiumFeatureTiers } from "../premium/PremiumConstants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export default function trackSoundPlayed(a0, a1, a2, a3, a4) {
const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId());
const guild_id = channel == null ? void 0 : channel.getGuildId();
const mediaSessionId = RTCConnectionStore.getMediaSessionId();
const rTCConnectionId = RTCConnectionStore.getRTCConnectionId();
const name = RunningGameStore_native.getCurrentGameForAnalytics()?.name;
const r30 = guild_id !== a2.guildId && a2.guildId !== DEFAULT_SOUND_GUILD_ID;
AnalyticsUtils.track(AnalyticEvents.PREMIUM_FEATURE_USAGE, {
feature_name: AnalyticsPremiumFeatureNames.SOUNDBOARD_PLAY,
feature_tier: r30 ? AnalyticsPremiumFeatureTiers.PREMIUM_STANDARD : AnalyticsPremiumFeatureTiers.FREE,
guild_id,
home_guild_id: a2.guildId,
location_stack: a0,
rtc_connection_id: rTCConnectionId,
media_session_id: mediaSessionId,
in_overlay: a1,
application_name: name,
emoji_count: a2.emojiId == null ? a2.emojiName != null ? 1 : 0 : 1,
feature_selection: a2.guildId !== DEFAULT_SOUND_GUILD_ID ? r30 ? "custom-external" : "custom" : "default",
feature_selection_id: a2.soundId,
sound_type: a3,
sequence_number: a4 != null ? a4 + 1 : null
});
};