52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
// Metro module 5782 (f5783).
|
|
import GatewayConnectionStore from "../gateway/GatewayConnectionStore";
|
|
import Module589 from "../../_bundle/Module589";
|
|
import { ChannelTypes } from "../../_bundle/Module692";
|
|
import Dispatcher from "../../Dispatcher";
|
|
let c3598_3, c3598_4;
|
|
const handleConnectionReset = function handleConnectionReset() {
|
|
c3598_3.clear();
|
|
};
|
|
const handleGuildReset = function handleGuildReset(a0) {
|
|
c3598_3.delete(a0.guild.id);
|
|
};
|
|
c3598_3 = new Set();
|
|
c3598_4 = {};
|
|
class ChannelStatusStore extends Module589.Store {
|
|
static displayName = "ChannelStatusStore";
|
|
initialize() {
|
|
this.waitFor(GatewayConnectionStore);
|
|
}
|
|
getChannelStatus(a0) {
|
|
if (a0 != null && a0.guild_id != null && a0.type === ChannelTypes.GUILD_VOICE) {
|
|
const r15 = c3598_4[a0.guild_id];
|
|
return r15 == null ? void 0 : r15[a0.id];
|
|
}
|
|
}
|
|
hasRequestedStatuses(a0) {
|
|
return c3598_3.has(a0);
|
|
}
|
|
}
|
|
const channelStatusStore = new ChannelStatusStore(Dispatcher, {
|
|
GUILD_CREATE: handleGuildReset,
|
|
GUILD_DELETE: handleGuildReset,
|
|
CONNECTION_RESUMED: handleConnectionReset,
|
|
CONNECTION_OPEN: handleConnectionReset,
|
|
VOICE_CHANNEL_STATUS_UPDATE: function handleVoiceChannelStatusUpdate(a0) {
|
|
if (c3598_4[a0.guildId] == null) {
|
|
c3598_4[a0.guildId] = {};
|
|
}
|
|
c3598_4[a0.guildId][a0.id] = a0.status;
|
|
},
|
|
CHANNEL_INFO: function handleChannelInfo({ guildId, channels }) {
|
|
c3598_4[guildId] = {};
|
|
for (const item of channels) {
|
|
c3598_4[guildId][item.id] = item.status;
|
|
}
|
|
},
|
|
FETCH_CHANNEL_INFO: function handleFetchChannelInfo(a0) {
|
|
c3598_3.add(a0.guildId);
|
|
}
|
|
});
|
|
export default channelStatusStore;
|