Files
discord-decomp/modules/go_live/utils/StreamKeyUtils.tsx
T
2026-11-01 12:12:55 +02:00

38 lines
1.1 KiB
TypeScript

// Metro module 4253 (f4254).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { StreamTypes } from "../Constants";
export function isStreamKey(a0) {
return a0 != null && (a0.startsWith(StreamTypes.GUILD) || a0.startsWith(StreamTypes.CALL));
}
export function decodeStreamKey(a0) {
const r11 = a0.split(":");
const r7 = r11[0];
if (StreamTypes.GUILD === r7) {
const r31 = _slicedToArray(r11, 4);
return {
streamType: r31[0],
guildId: r31[1],
channelId: r31[2],
ownerId: r31[3]
};
}
if (StreamTypes.CALL === r7) {
const r23 = _slicedToArray(r11, 3);
return {
streamType: r23[0],
channelId: r23[1],
ownerId: r23[2]
};
}
throw new Error(`Unknown stream type ${r7}`);
}
export function encodeStreamKey({ streamType, guildId, channelId, ownerId }) {
if (StreamTypes.GUILD === streamType) {
return [streamType, guildId, channelId, ownerId].join(":");
}
if (StreamTypes.CALL === streamType) {
return [streamType, channelId, ownerId].join(":");
}
throw new Error(`Unknown stream type ${streamType}`);
}