179 lines
5.1 KiB
TypeScript
179 lines
5.1 KiB
TypeScript
// Metro module 12696 (f12697).
|
|
import RTCRegionStore from "../../stores/RTCRegionStore";
|
|
import { EventEmitter } from "../../_bundle/EventEmitter_652";
|
|
import * as _GatewaySocketOpcode from "./GatewaySocketOpcode";
|
|
import SnowflakeUtils from "../../utils/SnowflakeUtils";
|
|
class GatewaySocketOpCodes extends EventEmitter {
|
|
presenceUpdate(a0, a1, a2, a3) {
|
|
this.send(_GatewaySocketOpcode.Opcode.PRESENCE_UPDATE, {
|
|
status: a0,
|
|
since: a1,
|
|
activities: a2,
|
|
afk: a3
|
|
});
|
|
}
|
|
voiceStateUpdate({ guildId = null, channelId = null, selfMute = false, selfDeaf = false, selfVideo = false, preferredRegion = null, preferredRegions = null, videoStreamParameters = null, flags = 0 }) {
|
|
const r6 = {
|
|
guild_id: guildId,
|
|
channel_id: channelId,
|
|
self_mute: selfMute,
|
|
self_deaf: selfDeaf,
|
|
self_video: selfVideo,
|
|
flags
|
|
};
|
|
if (channelId != null && RTCRegionStore.shouldIncludePreferredRegion()) {
|
|
r6.preferred_region = preferredRegion;
|
|
r6.preferred_regions = preferredRegions;
|
|
}
|
|
if (videoStreamParameters != null) {
|
|
r6.tracks = videoStreamParameters == null ? void 0 : videoStreamParameters.map((videoStreamParameter) => ({
|
|
type: videoStreamParameter.type,
|
|
rid: videoStreamParameter.rid,
|
|
quality: videoStreamParameter.quality
|
|
}));
|
|
}
|
|
this.send(_GatewaySocketOpcode.Opcode.VOICE_STATE_UPDATE, r6);
|
|
}
|
|
voiceServerPing() {
|
|
this.send(_GatewaySocketOpcode.Opcode.VOICE_SERVER_PING, null);
|
|
}
|
|
requestGuildMembers(a0, a1) {
|
|
this.send(_GatewaySocketOpcode.Opcode.REQUEST_GUILD_MEMBERS, {
|
|
guild_id: a0,
|
|
query: a1.query,
|
|
limit: a1.limit,
|
|
user_ids: a1.userIds,
|
|
presences: a1.presences
|
|
});
|
|
}
|
|
searchRecentMembers(a0, a1) {
|
|
let query = a1.query;
|
|
let continuationToken = a1.continuationToken;
|
|
const send = this.send;
|
|
const SEARCH_RECENT_MEMBERS = _GatewaySocketOpcode.Opcode.SEARCH_RECENT_MEMBERS;
|
|
if (query == null) {
|
|
query = "";
|
|
}
|
|
if (continuationToken == null) {
|
|
continuationToken = null;
|
|
}
|
|
send.call(this, SEARCH_RECENT_MEMBERS, {
|
|
guild_id: a0,
|
|
query,
|
|
continuation_token: continuationToken
|
|
});
|
|
}
|
|
updateGuildSubscriptions(a0) {
|
|
let subscriptions = {};
|
|
let c19978_0 = 0;
|
|
SnowflakeUtils.keys(a0).forEach((item) => {
|
|
const r5 = a0[item];
|
|
const length = JSON.stringify([item, r5]).length;
|
|
if (c19978_0 + length > 15360) {
|
|
this.send(_GatewaySocketOpcode.Opcode.GUILD_SUBSCRIPTIONS_BULK, {
|
|
subscriptions
|
|
});
|
|
subscriptions = {};
|
|
c19978_0 = 0;
|
|
}
|
|
subscriptions[item] = r5;
|
|
c19978_0 = c19978_0 + length;
|
|
});
|
|
if (c19978_0 > 0) {
|
|
this.send(_GatewaySocketOpcode.Opcode.GUILD_SUBSCRIPTIONS_BULK, {
|
|
subscriptions
|
|
});
|
|
}
|
|
}
|
|
callConnect(a0) {
|
|
this.send(_GatewaySocketOpcode.Opcode.CALL_CONNECT, {
|
|
channel_id: a0
|
|
});
|
|
}
|
|
streamCreate(a0, a1, a2, preferred_region = null) {
|
|
this.send(_GatewaySocketOpcode.Opcode.STREAM_CREATE, {
|
|
type: a0,
|
|
guild_id: a1,
|
|
channel_id: a2,
|
|
preferred_region
|
|
});
|
|
}
|
|
streamWatch(a0) {
|
|
this.send(_GatewaySocketOpcode.Opcode.STREAM_WATCH, {
|
|
stream_key: a0
|
|
});
|
|
}
|
|
streamPing(a0) {
|
|
this.send(_GatewaySocketOpcode.Opcode.STREAM_PING, {
|
|
stream_key: a0
|
|
});
|
|
}
|
|
streamDelete(a0) {
|
|
this.send(_GatewaySocketOpcode.Opcode.STREAM_DELETE, {
|
|
stream_key: a0
|
|
});
|
|
}
|
|
streamSetPaused(a0, a1) {
|
|
this.send(_GatewaySocketOpcode.Opcode.STREAM_SET_PAUSED, {
|
|
stream_key: a0,
|
|
paused: a1
|
|
});
|
|
}
|
|
requestForumUnreads(a0, a1, a2) {
|
|
this.send(_GatewaySocketOpcode.Opcode.REQUEST_FORUM_UNREADS, {
|
|
guild_id: a0,
|
|
channel_id: a1,
|
|
threads: a2.map((item) => ({
|
|
thread_id: item.threadId,
|
|
ack_message_id: item.ackMessageId
|
|
}))
|
|
});
|
|
}
|
|
requestSoundboardSounds(a0) {
|
|
this.send(_GatewaySocketOpcode.Opcode.REQUEST_SOUNDBOARD_SOUNDS, {
|
|
guild_ids: a0
|
|
});
|
|
}
|
|
requestLastMessages(a0, a1) {
|
|
this.send(_GatewaySocketOpcode.Opcode.REQUEST_LAST_MESSAGES, {
|
|
guild_id: a0,
|
|
channel_ids: a1
|
|
});
|
|
}
|
|
getDeletedEntityIdsNotMatchingHash(a0, a1, a2, a3, a4) {
|
|
this.send(_GatewaySocketOpcode.Opcode.GET_DELETED_ENTITY_IDS_NOT_MATCHING_HASH, {
|
|
guild_id: a0,
|
|
channel_ids_hash: a1,
|
|
role_ids_hash: a2,
|
|
emoji_ids_hash: a3,
|
|
sticker_ids_hash: a4
|
|
});
|
|
}
|
|
triggerGuildChannelResync(a0, a1) {
|
|
this.send(_GatewaySocketOpcode.Opcode.GUILD_CHANNELS_RESYNC, {
|
|
guild_id: a0,
|
|
obfuscated_channel_ids: a1
|
|
});
|
|
}
|
|
requestChannelInfo(a0, a1) {
|
|
this.send(_GatewaySocketOpcode.Opcode.REQUEST_CHANNEL_INFO, {
|
|
guild_id: a0,
|
|
fields: a1
|
|
});
|
|
}
|
|
requestChannelMemberCount(a0, a1) {
|
|
this.send(_GatewaySocketOpcode.Opcode.REQUEST_CHANNEL_MEMBER_COUNT, {
|
|
guild_id: a0,
|
|
channel_id: a1
|
|
});
|
|
}
|
|
remoteCommand(a0, a1) {
|
|
this.send(_GatewaySocketOpcode.Opcode.REMOTE_COMMAND, {
|
|
target_session_id: a0,
|
|
payload: a1
|
|
});
|
|
}
|
|
}
|
|
export default GatewaySocketOpCodes;
|
|
export const Opcode = _GatewaySocketOpcode.Opcode;
|