disgroove 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/class/Client.d.ts +306 -0
- package/dist/class/Client.js +771 -0
- package/dist/class/Client.js.map +1 -0
- package/dist/class/index.d.ts +1 -0
- package/dist/class/index.js +18 -0
- package/dist/class/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/rest/Endpoints.d.ts +97 -0
- package/dist/rest/Endpoints.js +205 -0
- package/dist/rest/Endpoints.js.map +1 -0
- package/dist/rest/REST.d.ts +16 -0
- package/dist/rest/REST.js +55 -0
- package/dist/rest/REST.js.map +1 -0
- package/dist/rest/index.d.ts +2 -0
- package/dist/rest/index.js +32 -0
- package/dist/rest/index.js.map +1 -0
- package/dist/structures/Application.d.ts +250 -0
- package/dist/structures/Application.js +258 -0
- package/dist/structures/Application.js.map +1 -0
- package/dist/structures/ApplicationCommand.d.ts +68 -0
- package/dist/structures/ApplicationCommand.js +133 -0
- package/dist/structures/ApplicationCommand.js.map +1 -0
- package/dist/structures/AuditLogEntry.d.ts +16 -0
- package/dist/structures/AuditLogEntry.js +54 -0
- package/dist/structures/AuditLogEntry.js.map +1 -0
- package/dist/structures/AutoModerationRule.d.ts +29 -0
- package/dist/structures/AutoModerationRule.js +85 -0
- package/dist/structures/AutoModerationRule.js.map +1 -0
- package/dist/structures/Channel.d.ts +296 -0
- package/dist/structures/Channel.js +579 -0
- package/dist/structures/Channel.js.map +1 -0
- package/dist/structures/Guild.d.ts +452 -0
- package/dist/structures/Guild.js +1161 -0
- package/dist/structures/Guild.js.map +1 -0
- package/dist/structures/GuildMember.d.ts +46 -0
- package/dist/structures/GuildMember.js +126 -0
- package/dist/structures/GuildMember.js.map +1 -0
- package/dist/structures/GuildScheduledEvent.d.ts +45 -0
- package/dist/structures/GuildScheduledEvent.js +115 -0
- package/dist/structures/GuildScheduledEvent.js.map +1 -0
- package/dist/structures/GuildTemplate.d.ts +25 -0
- package/dist/structures/GuildTemplate.js +80 -0
- package/dist/structures/GuildTemplate.js.map +1 -0
- package/dist/structures/Integration.d.ts +28 -0
- package/dist/structures/Integration.js +96 -0
- package/dist/structures/Integration.js.map +1 -0
- package/dist/structures/Interaction.d.ts +204 -0
- package/dist/structures/Interaction.js +368 -0
- package/dist/structures/Interaction.js.map +1 -0
- package/dist/structures/Invite.d.ts +22 -0
- package/dist/structures/Invite.js +108 -0
- package/dist/structures/Invite.js.map +1 -0
- package/dist/structures/Message.d.ts +97 -0
- package/dist/structures/Message.js +327 -0
- package/dist/structures/Message.js.map +1 -0
- package/dist/structures/Role.d.ts +35 -0
- package/dist/structures/Role.js +81 -0
- package/dist/structures/Role.js.map +1 -0
- package/dist/structures/StageInstance.d.ts +20 -0
- package/dist/structures/StageInstance.js +53 -0
- package/dist/structures/StageInstance.js.map +1 -0
- package/dist/structures/User.d.ts +53 -0
- package/dist/structures/User.js +168 -0
- package/dist/structures/User.js.map +1 -0
- package/dist/structures/Webhook.d.ts +133 -0
- package/dist/structures/Webhook.js +189 -0
- package/dist/structures/Webhook.js.map +1 -0
- package/dist/structures/index.d.ts +17 -0
- package/dist/structures/index.js +34 -0
- package/dist/structures/index.js.map +1 -0
- package/dist/types/application-command.d.ts +97 -0
- package/dist/types/application-command.js +3 -0
- package/dist/types/application-command.js.map +1 -0
- package/dist/types/application-role-connection-metadata.d.ts +17 -0
- package/dist/types/application-role-connection-metadata.js +3 -0
- package/dist/types/application-role-connection-metadata.js.map +1 -0
- package/dist/types/application.d.ts +55 -0
- package/dist/types/application.js +3 -0
- package/dist/types/application.js.map +1 -0
- package/dist/types/audit-log.d.ts +77 -0
- package/dist/types/audit-log.js +3 -0
- package/dist/types/audit-log.js.map +1 -0
- package/dist/types/auto-moderation.d.ts +61 -0
- package/dist/types/auto-moderation.js +3 -0
- package/dist/types/auto-moderation.js.map +1 -0
- package/dist/types/channel.d.ts +411 -0
- package/dist/types/channel.js +3 -0
- package/dist/types/channel.js.map +1 -0
- package/dist/types/emoji.d.ts +22 -0
- package/dist/types/emoji.js +3 -0
- package/dist/types/emoji.js.map +1 -0
- package/dist/types/gateway-events.d.ts +53 -0
- package/dist/types/gateway-events.js +3 -0
- package/dist/types/gateway-events.js.map +1 -0
- package/dist/types/guild-scheduled-event.d.ts +55 -0
- package/dist/types/guild-scheduled-event.js +3 -0
- package/dist/types/guild-scheduled-event.js.map +1 -0
- package/dist/types/guild-template.d.ts +28 -0
- package/dist/types/guild-template.js +3 -0
- package/dist/types/guild-template.js.map +1 -0
- package/dist/types/guild.d.ts +305 -0
- package/dist/types/guild.js +3 -0
- package/dist/types/guild.js.map +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.js +39 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/interaction.d.ts +141 -0
- package/dist/types/interaction.js +3 -0
- package/dist/types/interaction.js.map +1 -0
- package/dist/types/invite.d.ts +56 -0
- package/dist/types/invite.js +3 -0
- package/dist/types/invite.js.map +1 -0
- package/dist/types/message-components.d.ts +76 -0
- package/dist/types/message-components.js +3 -0
- package/dist/types/message-components.js.map +1 -0
- package/dist/types/oauth2.d.ts +14 -0
- package/dist/types/oauth2.js +3 -0
- package/dist/types/oauth2.js.map +1 -0
- package/dist/types/role.d.ts +42 -0
- package/dist/types/role.js +3 -0
- package/dist/types/role.js.map +1 -0
- package/dist/types/stage-instance.d.ts +18 -0
- package/dist/types/stage-instance.js +3 -0
- package/dist/types/stage-instance.js.map +1 -0
- package/dist/types/sticker.d.ts +59 -0
- package/dist/types/sticker.js +3 -0
- package/dist/types/sticker.js.map +1 -0
- package/dist/types/team.d.ts +28 -0
- package/dist/types/team.js +3 -0
- package/dist/types/team.js.map +1 -0
- package/dist/types/user.d.ts +73 -0
- package/dist/types/user.js +3 -0
- package/dist/types/user.js.map +1 -0
- package/dist/types/voice.d.ts +46 -0
- package/dist/types/voice.js +3 -0
- package/dist/types/voice.js.map +1 -0
- package/dist/types/webhook.d.ts +31 -0
- package/dist/types/webhook.js +3 -0
- package/dist/types/webhook.js.map +1 -0
- package/dist/utils/constants.d.ts +963 -0
- package/dist/utils/constants.js +1147 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/rawers.d.ts +467 -0
- package/dist/utils/rawers.js +295 -0
- package/dist/utils/rawers.js.map +1 -0
- package/package.json +27 -0
|
@@ -0,0 +1,771 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Client = void 0;
|
|
7
|
+
const ws_1 = __importDefault(require("ws"));
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const rest_1 = require("../rest");
|
|
10
|
+
const structures_1 = require("../structures");
|
|
11
|
+
const node_events_1 = __importDefault(require("node:events"));
|
|
12
|
+
class Client extends node_events_1.default {
|
|
13
|
+
heartbeatInterval;
|
|
14
|
+
token;
|
|
15
|
+
intents;
|
|
16
|
+
rest;
|
|
17
|
+
ws;
|
|
18
|
+
constructor(token, options) {
|
|
19
|
+
super();
|
|
20
|
+
this.token = token;
|
|
21
|
+
this.intents = options?.intents || utils_1.GatewayIntents.AllNonPrivileged;
|
|
22
|
+
this.rest = new rest_1.REST(token);
|
|
23
|
+
this.ws = new ws_1.default("wss://gateway.discord.gg/?v=10&encoding=json");
|
|
24
|
+
}
|
|
25
|
+
/* https://discord.com/developers/docs/resources/application#get-current-application */
|
|
26
|
+
async getApplication() {
|
|
27
|
+
return new structures_1.Application(await this.rest.request("GET", rest_1.Endpoints.applicationCurrentUser()), this);
|
|
28
|
+
}
|
|
29
|
+
/* https://discord.com/developers/docs/resources/channel#get-channel */
|
|
30
|
+
async getChannel(channelId) {
|
|
31
|
+
return new structures_1.Channel(await this.rest.request("GET", rest_1.Endpoints.channel(channelId)), this);
|
|
32
|
+
}
|
|
33
|
+
/* https://discord.com/developers/docs/resources/guild#create-guild */
|
|
34
|
+
async createGuild(options) {
|
|
35
|
+
return new structures_1.Guild(await this.rest.request("POST", rest_1.Endpoints.guilds(), {
|
|
36
|
+
json: {
|
|
37
|
+
name: options.name,
|
|
38
|
+
region: options.region,
|
|
39
|
+
icon: options.icon,
|
|
40
|
+
verification_level: options.verificationLevel,
|
|
41
|
+
default_message_notifications: options.defaultMessageNotifications,
|
|
42
|
+
explicit_content_filter: options.explicitContentFilter,
|
|
43
|
+
roles: options.roles?.map((role) => (0, utils_1.rawRole)(role)),
|
|
44
|
+
channels: options.channels?.map((channel) => (0, utils_1.rawChannel)(channel)),
|
|
45
|
+
afk_channel_id: options.afkChannelId,
|
|
46
|
+
afk_timeout: options.afkTimeout,
|
|
47
|
+
system_channel_id: options.systemChannelId,
|
|
48
|
+
system_channel_flags: options.systemChannelFlags,
|
|
49
|
+
},
|
|
50
|
+
}), this);
|
|
51
|
+
}
|
|
52
|
+
/* https://discord.com/developers/docs/resources/guild#get-guild */
|
|
53
|
+
async getGuild(guildId, options) {
|
|
54
|
+
return new structures_1.Guild(await this.rest.request("GET", rest_1.Endpoints.guild(guildId), {
|
|
55
|
+
query: {
|
|
56
|
+
with_counts: options?.withCounts,
|
|
57
|
+
},
|
|
58
|
+
}), this);
|
|
59
|
+
}
|
|
60
|
+
/* https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template */
|
|
61
|
+
async createGuildFromTemplate(code) {
|
|
62
|
+
return new structures_1.Guild(await this.rest.request("POST", rest_1.Endpoints.template(code)), this);
|
|
63
|
+
}
|
|
64
|
+
/* https://discord.com/developers/docs/resources/invite#get-invite */
|
|
65
|
+
async getInvite(code, options) {
|
|
66
|
+
return new structures_1.Invite(await this.rest.request("GET", rest_1.Endpoints.invite(code), {
|
|
67
|
+
query: {
|
|
68
|
+
with_counts: options?.withCounts,
|
|
69
|
+
with_expiration: options?.withExpiration,
|
|
70
|
+
guild_scheduled_event_id: options?.guildScheduledEventId,
|
|
71
|
+
},
|
|
72
|
+
}), this);
|
|
73
|
+
}
|
|
74
|
+
/* https://discord.com/developers/docs/resources/invite#delete-invite */
|
|
75
|
+
async deleteInvite(code, reason) {
|
|
76
|
+
return new structures_1.Invite(await this.rest.request("DELETE", rest_1.Endpoints.invite(code), {
|
|
77
|
+
reason,
|
|
78
|
+
}), this).toJSON();
|
|
79
|
+
}
|
|
80
|
+
/* https://discord.com/developers/docs/resources/stage-instance#create-stage-instance */
|
|
81
|
+
async createStageInstance(options, reason) {
|
|
82
|
+
return new structures_1.StageInstance(await this.rest.request("POST", rest_1.Endpoints.stageInstances(), {
|
|
83
|
+
json: {
|
|
84
|
+
channel_id: options.channelId,
|
|
85
|
+
topic: options.topic,
|
|
86
|
+
privacy_level: options.privacyLevel,
|
|
87
|
+
send_start_notifications: options.sendStartNotifications,
|
|
88
|
+
},
|
|
89
|
+
reason,
|
|
90
|
+
}), this);
|
|
91
|
+
}
|
|
92
|
+
/* https://discord.com/developers/docs/resources/stage-instance#get-stage-instance */
|
|
93
|
+
async getStageInstance(channelId) {
|
|
94
|
+
return new structures_1.StageInstance(await this.rest.request("GET", rest_1.Endpoints.stageInstance(channelId)), this);
|
|
95
|
+
}
|
|
96
|
+
/* https://discord.com/developers/docs/resources/sticker#list-nitro-sticker-packs */
|
|
97
|
+
async listNitroStickerPacks() {
|
|
98
|
+
const data = await this.rest.request("GET", rest_1.Endpoints.nitroStickerPacks());
|
|
99
|
+
return {
|
|
100
|
+
stickerPacks: data.sticker_packs.map((stickerPack) => ({
|
|
101
|
+
id: stickerPack.id,
|
|
102
|
+
stickers: stickerPack.stickers.map((sticker) => ({
|
|
103
|
+
id: sticker.id,
|
|
104
|
+
packId: sticker.pack_id,
|
|
105
|
+
name: sticker.name,
|
|
106
|
+
description: sticker.description,
|
|
107
|
+
tags: sticker.tags,
|
|
108
|
+
asset: sticker.asset,
|
|
109
|
+
type: sticker.type,
|
|
110
|
+
formatType: sticker.format_type,
|
|
111
|
+
available: sticker.available,
|
|
112
|
+
guildId: sticker.guild_id,
|
|
113
|
+
user: sticker.user !== undefined
|
|
114
|
+
? new structures_1.User(sticker.user, this)
|
|
115
|
+
: undefined,
|
|
116
|
+
sortValue: sticker.sort_value,
|
|
117
|
+
})),
|
|
118
|
+
name: stickerPack.name,
|
|
119
|
+
skuId: stickerPack.sku_id,
|
|
120
|
+
coverStickerId: stickerPack.cover_sticker_id,
|
|
121
|
+
description: stickerPack.description,
|
|
122
|
+
bannerAssetId: stickerPack.banner_asset_id,
|
|
123
|
+
})),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/* https://discord.com/developers/docs/resources/user#get-user */
|
|
127
|
+
async getUser(userId) {
|
|
128
|
+
return new structures_1.User(await this.rest.request("GET", rest_1.Endpoints.user(userId ?? "@me")), this);
|
|
129
|
+
}
|
|
130
|
+
/* https://discord.com/developers/docs/resources/user#get-current-user-guilds */
|
|
131
|
+
async getGuilds(options) {
|
|
132
|
+
return this.rest
|
|
133
|
+
.request("GET", rest_1.Endpoints.userGuilds(), {
|
|
134
|
+
query: {
|
|
135
|
+
before: options?.before,
|
|
136
|
+
after: options?.after,
|
|
137
|
+
limit: options?.limit,
|
|
138
|
+
with_counts: options?.withCounts,
|
|
139
|
+
},
|
|
140
|
+
})
|
|
141
|
+
.then((response) => response.map((data) => new structures_1.Guild(data, this)));
|
|
142
|
+
}
|
|
143
|
+
/* https://discord.com/developers/docs/resources/voice#list-voice-regions */
|
|
144
|
+
async listVoiceRegions() {
|
|
145
|
+
return this.rest.request("GET", rest_1.Endpoints.voiceRegions()).then((response) => response.map((data) => ({
|
|
146
|
+
id: data.id,
|
|
147
|
+
name: data.name,
|
|
148
|
+
optimal: data.optimal,
|
|
149
|
+
deprecated: data.deprecated,
|
|
150
|
+
custom: data.custom,
|
|
151
|
+
})));
|
|
152
|
+
}
|
|
153
|
+
connect() {
|
|
154
|
+
this.ws.on("open", () => {
|
|
155
|
+
this.ws.send(JSON.stringify({
|
|
156
|
+
op: utils_1.GatewayOPCodes.Identify,
|
|
157
|
+
d: {
|
|
158
|
+
token: this.token,
|
|
159
|
+
intents: this.intents,
|
|
160
|
+
properties: {
|
|
161
|
+
os: process.platform,
|
|
162
|
+
browser: "disgroove",
|
|
163
|
+
device: "disgroove",
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
}));
|
|
167
|
+
});
|
|
168
|
+
this.ws.on("message", (data) => {
|
|
169
|
+
const { t, op, d } = JSON.parse(data.toString());
|
|
170
|
+
switch (op) {
|
|
171
|
+
case utils_1.GatewayOPCodes.Reconnect:
|
|
172
|
+
super.emit(utils_1.GatewayEvents.Reconnect);
|
|
173
|
+
break;
|
|
174
|
+
case utils_1.GatewayOPCodes.InvalidSession:
|
|
175
|
+
super.emit(utils_1.GatewayEvents.InvalidSession);
|
|
176
|
+
break;
|
|
177
|
+
case utils_1.GatewayOPCodes.Hello:
|
|
178
|
+
{
|
|
179
|
+
this.heartbeatInterval = setInterval(() => {
|
|
180
|
+
this.ws.send(JSON.stringify({
|
|
181
|
+
op: utils_1.GatewayOPCodes.Heartbeat,
|
|
182
|
+
d: null,
|
|
183
|
+
}));
|
|
184
|
+
}, d.heartbeat_interval);
|
|
185
|
+
super.emit(utils_1.GatewayEvents.Hello, {
|
|
186
|
+
heartbeatInterval: d.heartbeat_interval,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
switch (t) {
|
|
192
|
+
case "READY":
|
|
193
|
+
super.emit(utils_1.GatewayEvents.Ready);
|
|
194
|
+
break;
|
|
195
|
+
case "RESUMED":
|
|
196
|
+
super.emit(utils_1.GatewayEvents.Resumed);
|
|
197
|
+
break;
|
|
198
|
+
case "APPLICATION_COMMAND_PERMISSIONS_UPDATE":
|
|
199
|
+
super.emit(utils_1.GatewayEvents.ApplicationCommandPermissionsUpdate, {
|
|
200
|
+
id: d.id,
|
|
201
|
+
applicationId: d.application_id,
|
|
202
|
+
guildId: d.guild_id,
|
|
203
|
+
permissions: d.permissions.map((permission) => ({
|
|
204
|
+
id: permission.id,
|
|
205
|
+
type: permission.type,
|
|
206
|
+
permission: permission.permission,
|
|
207
|
+
})),
|
|
208
|
+
});
|
|
209
|
+
break;
|
|
210
|
+
case "AUTO_MODERATION_RULE_CREATE":
|
|
211
|
+
super.emit(utils_1.GatewayEvents.AutoModerationRuleCreate, new structures_1.AutoModerationRule(d, this));
|
|
212
|
+
break;
|
|
213
|
+
case "AUTO_MODERATION_RULE_UPDATE":
|
|
214
|
+
super.emit(utils_1.GatewayEvents.AutoModerationRuleUpdate, new structures_1.AutoModerationRule(d, this));
|
|
215
|
+
break;
|
|
216
|
+
case "AUTO_MODERATION_RULE_DELETE":
|
|
217
|
+
super.emit(utils_1.GatewayEvents.AutoModerationRuleDelete, new structures_1.AutoModerationRule(d, this).toJSON());
|
|
218
|
+
break;
|
|
219
|
+
case "AUTO_MODERATION_ACTION_EXECUTION":
|
|
220
|
+
super.emit(utils_1.GatewayEvents.AutoModerationActionExecution, {
|
|
221
|
+
guildId: d.guild_id,
|
|
222
|
+
action: {
|
|
223
|
+
type: d.action.type,
|
|
224
|
+
metadata: d.action.metadata,
|
|
225
|
+
},
|
|
226
|
+
ruleId: d.rule_id,
|
|
227
|
+
ruleTriggerType: d.rule_trigger_type,
|
|
228
|
+
userId: d.user_id,
|
|
229
|
+
channelId: d.channel_id,
|
|
230
|
+
messageId: d.message_id,
|
|
231
|
+
alertSystemMessageId: d.alert_system_message_id,
|
|
232
|
+
content: d.content,
|
|
233
|
+
matchedKeyword: d.matched_keyword,
|
|
234
|
+
matchedContent: d.matched_content,
|
|
235
|
+
});
|
|
236
|
+
break;
|
|
237
|
+
case "CHANNEL_CREATE":
|
|
238
|
+
super.emit(utils_1.GatewayEvents.ChannelCreate, new structures_1.Channel(d, this));
|
|
239
|
+
break;
|
|
240
|
+
case "CHANNEL_UPDATE":
|
|
241
|
+
super.emit(utils_1.GatewayEvents.ChannelUpdate, new structures_1.Channel(d, this));
|
|
242
|
+
break;
|
|
243
|
+
case "CHANNEL_DELETE":
|
|
244
|
+
super.emit(utils_1.GatewayEvents.ChannelDelete, new structures_1.Channel(d, this).toJSON());
|
|
245
|
+
break;
|
|
246
|
+
case "CHANNEL_PINS_UPDATE":
|
|
247
|
+
super.emit(utils_1.GatewayEvents.ChannelPinsUpdate, {
|
|
248
|
+
guildId: d.guild_id,
|
|
249
|
+
channelId: d.channel_id,
|
|
250
|
+
lastPinTimestamp: d.last_pin_timestamp,
|
|
251
|
+
});
|
|
252
|
+
break;
|
|
253
|
+
case "THREAD_CREATE":
|
|
254
|
+
super.emit(utils_1.GatewayEvents.ThreadCreate, new structures_1.Channel(d, this));
|
|
255
|
+
break;
|
|
256
|
+
case "THREAD_UPDATE":
|
|
257
|
+
super.emit(utils_1.GatewayEvents.ThreadUpdate, new structures_1.Channel(d, this));
|
|
258
|
+
break;
|
|
259
|
+
case "THREAD_DELETE":
|
|
260
|
+
super.emit(utils_1.GatewayEvents.ThreadDelete, new structures_1.Channel(d, this).toJSON());
|
|
261
|
+
break;
|
|
262
|
+
case "THREAD_LIST_SYNC":
|
|
263
|
+
super.emit(utils_1.GatewayEvents.ThreadListSync, {
|
|
264
|
+
guildId: d.guild_id,
|
|
265
|
+
channelIds: d.channel_ids,
|
|
266
|
+
threads: d.threads.map((channel) => new structures_1.Channel(channel, this)),
|
|
267
|
+
members: d.members.map((member) => ({
|
|
268
|
+
id: member.id,
|
|
269
|
+
userId: member.user_id,
|
|
270
|
+
joinTimestamp: member.join_timestamp,
|
|
271
|
+
flags: member.flags,
|
|
272
|
+
member: member.member !== undefined
|
|
273
|
+
? new structures_1.GuildMember(member.member, this)
|
|
274
|
+
: undefined,
|
|
275
|
+
})),
|
|
276
|
+
});
|
|
277
|
+
break;
|
|
278
|
+
case "THREAD_MEMBER_UPDATE":
|
|
279
|
+
super.emit(utils_1.GatewayEvents.ThreadMemberUpdate, {
|
|
280
|
+
id: d.id,
|
|
281
|
+
userId: d.user_id,
|
|
282
|
+
joinTimestamp: d.join_timestamp,
|
|
283
|
+
flags: d.flags,
|
|
284
|
+
member: d.member !== undefined
|
|
285
|
+
? new structures_1.GuildMember(d.member, this)
|
|
286
|
+
: undefined,
|
|
287
|
+
guildId: d.guild_id,
|
|
288
|
+
});
|
|
289
|
+
break;
|
|
290
|
+
case "THREAD_MEMBERS_UPDATE":
|
|
291
|
+
super.emit(utils_1.GatewayEvents.ThreadMembersUpdate, {
|
|
292
|
+
id: d.id,
|
|
293
|
+
guildId: d.guild_id,
|
|
294
|
+
memberCount: d.member_count,
|
|
295
|
+
addedMembers: d.added_members?.map((member) => ({
|
|
296
|
+
id: member.id,
|
|
297
|
+
userId: member.user_id,
|
|
298
|
+
joinTimestamp: member.join_timestamp,
|
|
299
|
+
flags: member.flags,
|
|
300
|
+
member: member.member !== undefined
|
|
301
|
+
? new structures_1.GuildMember(member.member, this)
|
|
302
|
+
: undefined,
|
|
303
|
+
})),
|
|
304
|
+
removedMemberIds: d.removed_member_ids,
|
|
305
|
+
});
|
|
306
|
+
break;
|
|
307
|
+
case "GUILD_CREATE":
|
|
308
|
+
super.emit(utils_1.GatewayEvents.GuildCreate, new structures_1.Guild(d, this), {
|
|
309
|
+
joinedAt: d.joined_at,
|
|
310
|
+
large: d.large,
|
|
311
|
+
unavailable: d.unavailable,
|
|
312
|
+
memberCount: d.member_count,
|
|
313
|
+
voiceStates: d.voice_states.map((voiceState) => ({
|
|
314
|
+
guildId: voiceState.guild_id,
|
|
315
|
+
channelId: voiceState.channel_id,
|
|
316
|
+
userId: voiceState.user_id,
|
|
317
|
+
member: voiceState.member !== undefined
|
|
318
|
+
? new structures_1.GuildMember(voiceState.member, this)
|
|
319
|
+
: undefined,
|
|
320
|
+
sessionId: voiceState.session_id,
|
|
321
|
+
deaf: voiceState.deaf,
|
|
322
|
+
mute: voiceState.mute,
|
|
323
|
+
selfDeaf: voiceState.self_deaf,
|
|
324
|
+
selfMute: voiceState.self_mute,
|
|
325
|
+
selfStream: voiceState.self_stream,
|
|
326
|
+
selfVideo: voiceState.self_video,
|
|
327
|
+
suppress: voiceState.suppress,
|
|
328
|
+
requestToSpeakTimestamp: voiceState.request_to_speak_timestamp,
|
|
329
|
+
})),
|
|
330
|
+
members: d.members.map((member) => new structures_1.GuildMember(member, this)),
|
|
331
|
+
channels: d.channels.map((channel) => new structures_1.Channel(channel, this)),
|
|
332
|
+
threads: d.threads.map((thread) => new structures_1.Channel(thread, this)),
|
|
333
|
+
presences: d.presences.map((presence) => ({
|
|
334
|
+
user: new structures_1.User(presence.user, this),
|
|
335
|
+
guildId: presence.guild_id,
|
|
336
|
+
status: presence.status,
|
|
337
|
+
activities: presence.activities.map((activity) => ({
|
|
338
|
+
name: activity.name,
|
|
339
|
+
type: activity.type,
|
|
340
|
+
url: activity.url,
|
|
341
|
+
createdAt: activity.created_at,
|
|
342
|
+
timestamps: {
|
|
343
|
+
start: activity.timestamps?.start,
|
|
344
|
+
end: activity.timestamp.end,
|
|
345
|
+
},
|
|
346
|
+
applicationId: activity.application_id,
|
|
347
|
+
details: activity.details,
|
|
348
|
+
state: activity.state,
|
|
349
|
+
party: {
|
|
350
|
+
id: activity.party?.id,
|
|
351
|
+
size: activity.party?.size,
|
|
352
|
+
},
|
|
353
|
+
assets: {
|
|
354
|
+
largeImage: activity.assets?.large_image,
|
|
355
|
+
largeText: activity.assets?.large_text,
|
|
356
|
+
smallImage: activity.assets?.small_image,
|
|
357
|
+
smallText: activity.assets?.small_text,
|
|
358
|
+
},
|
|
359
|
+
secrets: {
|
|
360
|
+
join: activity.secrets.join,
|
|
361
|
+
spectate: activity.secrets.spectate,
|
|
362
|
+
match: activity.secrets.match,
|
|
363
|
+
},
|
|
364
|
+
instance: activity.instance,
|
|
365
|
+
flags: activity.flags,
|
|
366
|
+
buttons: activity.buttons?.map((button) => ({
|
|
367
|
+
label: button.label,
|
|
368
|
+
url: button.url,
|
|
369
|
+
})),
|
|
370
|
+
})),
|
|
371
|
+
clientStatus: {
|
|
372
|
+
desktop: presence.client_status.desktop,
|
|
373
|
+
mobile: presence.client_status.mobile,
|
|
374
|
+
web: presence.client_status.web,
|
|
375
|
+
},
|
|
376
|
+
})),
|
|
377
|
+
stageInstances: d.stage_instances.map((stageInstance) => new structures_1.StageInstance(stageInstance, this)),
|
|
378
|
+
guildScheduledEvents: d.guild_scheduled_events.map((guildScheduledEvent) => new structures_1.GuildScheduledEvent(guildScheduledEvent, this)),
|
|
379
|
+
});
|
|
380
|
+
break;
|
|
381
|
+
case "GUILD_UPDATE":
|
|
382
|
+
super.emit(utils_1.GatewayEvents.GuildUpdate, new structures_1.Guild(d, this));
|
|
383
|
+
break;
|
|
384
|
+
case "GUILD_DELETE":
|
|
385
|
+
super.emit(utils_1.GatewayEvents.GuildDelete, {
|
|
386
|
+
id: d.id,
|
|
387
|
+
unavailable: d.unavailable,
|
|
388
|
+
});
|
|
389
|
+
break;
|
|
390
|
+
case "GUILD_AUDIT_LOG_ENTRY_CREATE":
|
|
391
|
+
super.emit(utils_1.GatewayEvents.GuildAuditLogEntryCreate, new structures_1.AuditLogEntry(d, this));
|
|
392
|
+
break;
|
|
393
|
+
case "GUILD_BAN_ADD":
|
|
394
|
+
super.emit(utils_1.GatewayEvents.GuildBanAdd, {
|
|
395
|
+
guildId: d.guild_id,
|
|
396
|
+
user: new structures_1.User(d.user, this),
|
|
397
|
+
});
|
|
398
|
+
break;
|
|
399
|
+
case "GUILD_BAN_REMOVE":
|
|
400
|
+
super.emit(utils_1.GatewayEvents.GuildBanRemove, {
|
|
401
|
+
guildId: d.guild_id,
|
|
402
|
+
user: new structures_1.User(d.user, this),
|
|
403
|
+
});
|
|
404
|
+
break;
|
|
405
|
+
case "GUILD_EMOJIS_UPDATE":
|
|
406
|
+
super.emit(utils_1.GatewayEvents.GuildEmojisUpdate, {
|
|
407
|
+
guildId: d.guild_id,
|
|
408
|
+
emojis: d.emojis.map((emoji) => ({
|
|
409
|
+
id: emoji.id,
|
|
410
|
+
name: emoji.name,
|
|
411
|
+
roles: emoji.roles,
|
|
412
|
+
user: emoji.roles,
|
|
413
|
+
requireColons: emoji.require_colons,
|
|
414
|
+
managed: emoji.managed,
|
|
415
|
+
animated: emoji.animated,
|
|
416
|
+
available: emoji.available,
|
|
417
|
+
})),
|
|
418
|
+
});
|
|
419
|
+
break;
|
|
420
|
+
case "GUILD_STICKERS_UPDATE":
|
|
421
|
+
super.emit(utils_1.GatewayEvents.GuildStickersUpdate, {
|
|
422
|
+
guildId: d.guild_id,
|
|
423
|
+
stickers: d.stickers.map((sticker) => ({
|
|
424
|
+
id: sticker.id,
|
|
425
|
+
packId: sticker.pack_id,
|
|
426
|
+
name: sticker.name,
|
|
427
|
+
description: sticker.description,
|
|
428
|
+
tags: sticker.tags,
|
|
429
|
+
asset: sticker.asset,
|
|
430
|
+
type: sticker.type,
|
|
431
|
+
formatType: sticker.format_type,
|
|
432
|
+
available: sticker.available,
|
|
433
|
+
guildId: sticker.guild_id,
|
|
434
|
+
user: sticker.user !== undefined
|
|
435
|
+
? new structures_1.User(sticker.user, this)
|
|
436
|
+
: undefined,
|
|
437
|
+
sortValue: sticker.sort_value,
|
|
438
|
+
})),
|
|
439
|
+
});
|
|
440
|
+
break;
|
|
441
|
+
case "GUILD_INTEGRATIONS_UPDATE":
|
|
442
|
+
super.emit(utils_1.GatewayEvents.GuildIntegrationsUpdate, {
|
|
443
|
+
guildId: d.guild_id,
|
|
444
|
+
});
|
|
445
|
+
break;
|
|
446
|
+
case "GUILD_MEMBER_ADD":
|
|
447
|
+
super.emit(utils_1.GatewayEvents.GuildMemberAdd, new structures_1.GuildMember(d, this));
|
|
448
|
+
break;
|
|
449
|
+
case "GUILD_MEMBER_REMOVE":
|
|
450
|
+
super.emit(utils_1.GatewayEvents.GuildMemberRemove, {
|
|
451
|
+
guildId: d.guild_id,
|
|
452
|
+
user: new structures_1.User(d.user, this),
|
|
453
|
+
});
|
|
454
|
+
break;
|
|
455
|
+
case "GUILD_MEMBER_UPDATE":
|
|
456
|
+
super.emit(utils_1.GatewayEvents.GuildMemberUpdate, {
|
|
457
|
+
guildId: d.guild_id,
|
|
458
|
+
roles: d.roles,
|
|
459
|
+
user: new structures_1.User(d.user, this),
|
|
460
|
+
nick: d.nick,
|
|
461
|
+
avatar: d.avatar,
|
|
462
|
+
joinedAt: d.joined_at,
|
|
463
|
+
premiumSince: d.premium_since,
|
|
464
|
+
deaf: d.deaf,
|
|
465
|
+
mute: d.mute,
|
|
466
|
+
pending: d.pending,
|
|
467
|
+
communicationDisabledUntil: d.communication_disabled_until,
|
|
468
|
+
});
|
|
469
|
+
break;
|
|
470
|
+
case "GUILD_MEMBERS_CHUNK":
|
|
471
|
+
super.emit(utils_1.GatewayEvents.GuildMembersChunk, {
|
|
472
|
+
guildId: d.guild_id,
|
|
473
|
+
members: d.members.map((member) => new structures_1.GuildMember(member, this)),
|
|
474
|
+
chunkIndex: d.chunk_index,
|
|
475
|
+
chunkCount: d.chunk_count,
|
|
476
|
+
notFound: d.not_found,
|
|
477
|
+
presences: d.presences,
|
|
478
|
+
nonce: d.nonce,
|
|
479
|
+
});
|
|
480
|
+
break;
|
|
481
|
+
case "GUILD_ROLE_CREATE":
|
|
482
|
+
super.emit(utils_1.GatewayEvents.GuildRoleCreate, {
|
|
483
|
+
guildId: d.guild_id,
|
|
484
|
+
role: new structures_1.Role(d.role, this),
|
|
485
|
+
});
|
|
486
|
+
break;
|
|
487
|
+
case "GUILD_ROLE_UPDATE":
|
|
488
|
+
super.emit(utils_1.GatewayEvents.GuildRoleUpdate, {
|
|
489
|
+
guildId: d.guild_id,
|
|
490
|
+
role: new structures_1.Role(d.role, this),
|
|
491
|
+
});
|
|
492
|
+
break;
|
|
493
|
+
case "GUILD_ROLE_DELETE":
|
|
494
|
+
super.emit(utils_1.GatewayEvents.GuildRoleDelete, {
|
|
495
|
+
guildId: d.guild_id,
|
|
496
|
+
roleId: d.role_id,
|
|
497
|
+
});
|
|
498
|
+
break;
|
|
499
|
+
case "GUILD_SCHEDULED_EVENT_CREATE":
|
|
500
|
+
super.emit(utils_1.GatewayEvents.GuildScheduledEventCreate, new structures_1.GuildScheduledEvent(d, this));
|
|
501
|
+
break;
|
|
502
|
+
case "GUILD_SCHEDULED_EVENT_UPDATE":
|
|
503
|
+
super.emit(utils_1.GatewayEvents.GuildScheduledEventUpdate, new structures_1.GuildScheduledEvent(d, this));
|
|
504
|
+
break;
|
|
505
|
+
case "GUILD_SCHEDULED_EVENT_DELETE":
|
|
506
|
+
super.emit(utils_1.GatewayEvents.GuildScheduledEventDelete, new structures_1.GuildScheduledEvent(d, this).toJSON());
|
|
507
|
+
break;
|
|
508
|
+
case "GUILD_SCHEDULED_EVENT_USER_ADD":
|
|
509
|
+
super.emit(utils_1.GatewayEvents.GuildScheduledEventUserAdd, {
|
|
510
|
+
guildScheduledEventId: d.guild_scheduled_event_id,
|
|
511
|
+
userId: d.user_id,
|
|
512
|
+
guildId: d.guild_id,
|
|
513
|
+
});
|
|
514
|
+
break;
|
|
515
|
+
case "GUILD_SCHEDULED_EVENT_USER_REMOVE":
|
|
516
|
+
super.emit(utils_1.GatewayEvents.GuildScheduledEventUserRemove, {
|
|
517
|
+
guildScheduledEventId: d.guild_scheduled_event_id,
|
|
518
|
+
userId: d.user_id,
|
|
519
|
+
guildId: d.guild_id,
|
|
520
|
+
});
|
|
521
|
+
break;
|
|
522
|
+
case "INTEGRATION_CREATE":
|
|
523
|
+
super.emit(utils_1.GatewayEvents.IntegrationCreate, new structures_1.Integration(d, this), {
|
|
524
|
+
guildId: d.guild_id,
|
|
525
|
+
});
|
|
526
|
+
break;
|
|
527
|
+
case "INTEGRATION_UPDATE":
|
|
528
|
+
super.emit(utils_1.GatewayEvents.IntegrationUpdate, new structures_1.Integration(d, this), {
|
|
529
|
+
guildId: d.guild_id,
|
|
530
|
+
});
|
|
531
|
+
break;
|
|
532
|
+
case "INTEGRATION_DELETE":
|
|
533
|
+
super.emit(utils_1.GatewayEvents.IntegrationDelete, {
|
|
534
|
+
id: d.id,
|
|
535
|
+
guildId: d.guild_id,
|
|
536
|
+
applicationId: d.application_id,
|
|
537
|
+
});
|
|
538
|
+
break;
|
|
539
|
+
case "INTERACTION_CREATE":
|
|
540
|
+
super.emit(utils_1.GatewayEvents.InteractionCreate, new structures_1.Interaction(d, this));
|
|
541
|
+
break;
|
|
542
|
+
case "INVITE_CREATE":
|
|
543
|
+
super.emit(utils_1.GatewayEvents.InviteCreate, {
|
|
544
|
+
channelId: d.channel_id,
|
|
545
|
+
code: d.code,
|
|
546
|
+
createdAt: d.created_at,
|
|
547
|
+
guildId: d.guild_id,
|
|
548
|
+
inviter: d.inviter !== undefined ? new structures_1.User(d.inviter, this) : undefined,
|
|
549
|
+
maxAge: d.max_age,
|
|
550
|
+
maxUses: d.max_uses,
|
|
551
|
+
targetType: d.target_type,
|
|
552
|
+
targetUser: d.target_user !== undefined
|
|
553
|
+
? new structures_1.User(d.target_user, this)
|
|
554
|
+
: undefined,
|
|
555
|
+
targetApplication: d.target_application !== undefined
|
|
556
|
+
? new structures_1.Application(d.target_application, this)
|
|
557
|
+
: undefined,
|
|
558
|
+
temporary: d.temporary,
|
|
559
|
+
uses: d.uses,
|
|
560
|
+
});
|
|
561
|
+
break;
|
|
562
|
+
case "INVITE_DELETE":
|
|
563
|
+
super.emit(utils_1.GatewayEvents.InviteDelete, {
|
|
564
|
+
channelId: d.channel_id,
|
|
565
|
+
guildId: d.guild_id,
|
|
566
|
+
code: d.code,
|
|
567
|
+
});
|
|
568
|
+
break;
|
|
569
|
+
case "MESSAGE_CREATE":
|
|
570
|
+
super.emit(utils_1.GatewayEvents.MessageCreate, new structures_1.Message(d, this));
|
|
571
|
+
break;
|
|
572
|
+
case "MESSAGE_UPDATE":
|
|
573
|
+
super.emit(utils_1.GatewayEvents.MessageUpdate, new structures_1.Message(d, this));
|
|
574
|
+
break;
|
|
575
|
+
case "MESSAGE_DELETE":
|
|
576
|
+
super.emit(utils_1.GatewayEvents.MessageDelete, new structures_1.Message(d, this).toJSON());
|
|
577
|
+
break;
|
|
578
|
+
case "MESSAGE_DELETE_BULK":
|
|
579
|
+
super.emit(utils_1.GatewayEvents.MessageDeleteBulk, {
|
|
580
|
+
ids: d.ids,
|
|
581
|
+
channelId: d.channel_id,
|
|
582
|
+
guildId: d.guild_id,
|
|
583
|
+
});
|
|
584
|
+
break;
|
|
585
|
+
case "MESSAGE_REACTION_ADD":
|
|
586
|
+
super.emit(utils_1.GatewayEvents.MessageReactionAdd, {
|
|
587
|
+
userId: d.user_id,
|
|
588
|
+
channelId: d.channel_id,
|
|
589
|
+
messageId: d.message_id,
|
|
590
|
+
guildId: d.guild_id,
|
|
591
|
+
member: d.member !== undefined
|
|
592
|
+
? new structures_1.GuildMember(d.member, this)
|
|
593
|
+
: undefined,
|
|
594
|
+
emoji: {
|
|
595
|
+
id: d.emoji.id,
|
|
596
|
+
name: d.emoji.name,
|
|
597
|
+
roles: d.emoji.roles,
|
|
598
|
+
user: d.emoji.user !== undefined
|
|
599
|
+
? new structures_1.User(d.emoji.user, this)
|
|
600
|
+
: undefined,
|
|
601
|
+
requireColons: d.emoji.require_colons,
|
|
602
|
+
managed: d.emoji.managed,
|
|
603
|
+
animated: d.emoji.animated,
|
|
604
|
+
available: d.emoji.available,
|
|
605
|
+
},
|
|
606
|
+
messageAuthorId: d.message_author_id,
|
|
607
|
+
});
|
|
608
|
+
break;
|
|
609
|
+
case "MESSAGE_REACTION_REMOVE":
|
|
610
|
+
super.emit(utils_1.GatewayEvents.MessageReactionRemove, {
|
|
611
|
+
userId: d.user_id,
|
|
612
|
+
channelId: d.channel_id,
|
|
613
|
+
messageId: d.message_id,
|
|
614
|
+
guildId: d.guild_id,
|
|
615
|
+
emoji: {
|
|
616
|
+
id: d.emoji.id,
|
|
617
|
+
name: d.emoji.name,
|
|
618
|
+
roles: d.emoji.roles,
|
|
619
|
+
user: d.emoji.user !== undefined
|
|
620
|
+
? new structures_1.User(d.emoji.user, this)
|
|
621
|
+
: undefined,
|
|
622
|
+
requireColons: d.emoji.require_colons,
|
|
623
|
+
managed: d.emoji.managed,
|
|
624
|
+
animated: d.emoji.animated,
|
|
625
|
+
available: d.emoji.available,
|
|
626
|
+
},
|
|
627
|
+
});
|
|
628
|
+
break;
|
|
629
|
+
case "MESSAGE_REACTION_REMOVE_ALL":
|
|
630
|
+
super.emit(utils_1.GatewayEvents.MessageReactionRemoveAll, {
|
|
631
|
+
channelId: d.channel_id,
|
|
632
|
+
messageId: d.message_id,
|
|
633
|
+
guildId: d.guild_id,
|
|
634
|
+
});
|
|
635
|
+
break;
|
|
636
|
+
case "MESSAGE_REACTION_REMOVE_EMOJI":
|
|
637
|
+
super.emit(utils_1.GatewayEvents.MessageReactionRemoveEmoji, {
|
|
638
|
+
channelId: d.channel_id,
|
|
639
|
+
guildId: d.guild_id,
|
|
640
|
+
messageId: d.message_id,
|
|
641
|
+
emoji: {
|
|
642
|
+
id: d.emoji.id,
|
|
643
|
+
name: d.emoji.name,
|
|
644
|
+
roles: d.emoji.roles,
|
|
645
|
+
user: d.emoji.user !== undefined
|
|
646
|
+
? new structures_1.User(d.emoji.user, this)
|
|
647
|
+
: undefined,
|
|
648
|
+
requireColons: d.emoji.require_colons,
|
|
649
|
+
managed: d.emoji.managed,
|
|
650
|
+
animated: d.emoji.animated,
|
|
651
|
+
available: d.emoji.available,
|
|
652
|
+
},
|
|
653
|
+
});
|
|
654
|
+
break;
|
|
655
|
+
case "PRESENCE_UPDATE":
|
|
656
|
+
super.emit(utils_1.GatewayEvents.PresenceUpdate, {
|
|
657
|
+
user: new structures_1.User(d.user, this),
|
|
658
|
+
guildId: d.guild_id,
|
|
659
|
+
status: d.status,
|
|
660
|
+
activities: d.activities.map((activity) => ({
|
|
661
|
+
name: activity.name,
|
|
662
|
+
type: activity.type,
|
|
663
|
+
url: activity.url,
|
|
664
|
+
createdAt: activity.created_at,
|
|
665
|
+
timestamps: {
|
|
666
|
+
start: activity.timestamps?.start,
|
|
667
|
+
end: activity.timestamp.end,
|
|
668
|
+
},
|
|
669
|
+
applicationId: activity.application_id,
|
|
670
|
+
details: activity.details,
|
|
671
|
+
state: activity.state,
|
|
672
|
+
party: {
|
|
673
|
+
id: activity.party?.id,
|
|
674
|
+
size: activity.party?.size,
|
|
675
|
+
},
|
|
676
|
+
assets: {
|
|
677
|
+
largeImage: activity.assets?.large_image,
|
|
678
|
+
largeText: activity.assets?.large_text,
|
|
679
|
+
smallImage: activity.assets?.small_image,
|
|
680
|
+
smallText: activity.assets?.small_text,
|
|
681
|
+
},
|
|
682
|
+
secrets: {
|
|
683
|
+
join: activity.secrets.join,
|
|
684
|
+
spectate: activity.secrets.spectate,
|
|
685
|
+
match: activity.secrets.match,
|
|
686
|
+
},
|
|
687
|
+
instance: activity.instance,
|
|
688
|
+
flags: activity.flags,
|
|
689
|
+
buttons: activity.buttons?.map((button) => ({
|
|
690
|
+
label: button.label,
|
|
691
|
+
url: button.url,
|
|
692
|
+
})),
|
|
693
|
+
})),
|
|
694
|
+
clientStatus: {
|
|
695
|
+
desktop: d.client_status.desktop,
|
|
696
|
+
mobile: d.client_status.mobile,
|
|
697
|
+
web: d.client_status.web,
|
|
698
|
+
},
|
|
699
|
+
});
|
|
700
|
+
break;
|
|
701
|
+
case "STAGE_INSTANCE_CREATE":
|
|
702
|
+
super.emit(utils_1.GatewayEvents.StageInstanceCreate, new structures_1.StageInstance(d, this));
|
|
703
|
+
break;
|
|
704
|
+
case "STAGE_INSTANCE_UPDATE":
|
|
705
|
+
super.emit(utils_1.GatewayEvents.StageInstanceUpdate, new structures_1.StageInstance(d, this));
|
|
706
|
+
break;
|
|
707
|
+
case "STAGE_INSTANCE_DELETE":
|
|
708
|
+
super.emit(utils_1.GatewayEvents.StageInstanceDelete, new structures_1.StageInstance(d, this).toJSON());
|
|
709
|
+
break;
|
|
710
|
+
case "TYPING_START":
|
|
711
|
+
super.emit(utils_1.GatewayEvents.TypingStart, {
|
|
712
|
+
channelId: d.channel_id,
|
|
713
|
+
guildId: d.guild_id,
|
|
714
|
+
userId: d.user_id,
|
|
715
|
+
timestamp: d.timestamp,
|
|
716
|
+
member: d.member !== undefined
|
|
717
|
+
? new structures_1.GuildMember(d.member, this)
|
|
718
|
+
: undefined,
|
|
719
|
+
});
|
|
720
|
+
break;
|
|
721
|
+
case "USER_UPDATE":
|
|
722
|
+
super.emit(utils_1.GatewayEvents.UserUpdate, new structures_1.User(d, this));
|
|
723
|
+
break;
|
|
724
|
+
case "VOICE_STATE_UPDATE":
|
|
725
|
+
super.emit(utils_1.GatewayEvents.VoiceStateUpdate, {
|
|
726
|
+
guildId: d.guild_id,
|
|
727
|
+
channelId: d.channel_id,
|
|
728
|
+
userId: d.user_id,
|
|
729
|
+
member: d.member !== undefined
|
|
730
|
+
? new structures_1.GuildMember(d.member, this)
|
|
731
|
+
: undefined,
|
|
732
|
+
sessionId: d.session_id,
|
|
733
|
+
deaf: d.deaf,
|
|
734
|
+
mute: d.mute,
|
|
735
|
+
selfDeaf: d.self_deaf,
|
|
736
|
+
selfMute: d.self_mute,
|
|
737
|
+
selfStream: d.self_stream,
|
|
738
|
+
selfVideo: d.self_video,
|
|
739
|
+
suppress: d.suppress,
|
|
740
|
+
requestToSpeakTimestamp: d.request_to_speak_timestamp,
|
|
741
|
+
});
|
|
742
|
+
break;
|
|
743
|
+
case "VOICE_SERVER_UPDATE":
|
|
744
|
+
super.emit(utils_1.GatewayEvents.VoiceServerUpdate, {
|
|
745
|
+
token: d.token,
|
|
746
|
+
guildId: d.guildId,
|
|
747
|
+
endpoint: d.endpoint,
|
|
748
|
+
});
|
|
749
|
+
break;
|
|
750
|
+
case "WEBHOOKS_UPDATE":
|
|
751
|
+
super.emit(utils_1.GatewayEvents.WebhooksUpdate, {
|
|
752
|
+
guildId: d.guild_id,
|
|
753
|
+
channelId: d.channel_id,
|
|
754
|
+
});
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
this.ws.on("error", (err) => {
|
|
759
|
+
throw new Error(err.message);
|
|
760
|
+
});
|
|
761
|
+
this.ws.on("close", (code, reason) => {
|
|
762
|
+
throw new Error(`${code}: ${reason}`);
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
disconnect() {
|
|
766
|
+
clearInterval(this.heartbeatInterval);
|
|
767
|
+
this.heartbeatInterval = null;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
exports.Client = Client;
|
|
771
|
+
//# sourceMappingURL=Client.js.map
|