1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Lobby = exports.LobbyType = void 0;
const Base_1 = require("./Base");
var LobbyType;
(function (LobbyType) {
LobbyType[LobbyType["PRIVATE"] = 1] = "PRIVATE";
LobbyType[LobbyType["PUBLIC"] = 2] = "PUBLIC";
})(LobbyType || (exports.LobbyType = LobbyType = {}));
class Lobby extends Base_1.Base {
application_id;
capacity;
id;
locked;
members;
metadata;
owner_id;
region;
secret;
type;
voice_states;
constructor(client, props) {
super(client);
Object.assign(this, props);
this.application_id = props.application_id;
this.capacity = props.capacity;
this.id = props.id;
this.locked = props.locked;
this.members = props.members;
this.metadata = props.metadata;
this.owner_id = props.owner_id;
this.region = props.region;
this.secret = props.secret;
this.type = props.type;
this.voice_states = props.voice_states;
}
async joinVoice() {
await this.client.request("CONNECT_TO_LOBBY_VOICE", { id: this.id });
}
async leaveVoice() {
await this.client.request("DISCONNECT_FROM_LOBBY_VOICE", { id: this.id });
}
async update(type, owner_id, capacity, locked, metadata) {
this.type = type ?? this.type;
this.owner_id = owner_id ?? this.owner_id;
this.capacity = capacity ?? this.capacity;
this.locked = locked ?? this.locked;
this.metadata = metadata ?? this.metadata;
await this.client.request("UPDATE_LOBBY", {
id: this.id,
type,
owner_id,
capacity,
locked,
metadata
});
}
async updateMember(userId, metadata) {
await this.client.request("UPDATE_LOBBY_MEMBER", { lobby_id: this.id, user_id: userId, metadata });
}
async disconnect() {
await this.client.request("DISCONNECT_FROM_LOBBY", { id: this.id });
}
async delete() {
await this.client.request("DELETE_LOBBY", { id: this.id });
}
}
exports.Lobby = Lobby;
|