disgroove 2.2.0-dev.15819eb → 2.2.0-dev.4623b99
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/lib/Client.d.ts +500 -73
- package/dist/lib/Client.js +861 -716
- package/dist/lib/gateway/Shard.js +252 -62
- package/dist/lib/index.d.ts +25 -0
- package/dist/lib/index.js +25 -0
- package/dist/lib/types/application-command.d.ts +0 -73
- package/dist/lib/types/application.d.ts +0 -12
- package/dist/lib/types/auto-moderation.d.ts +0 -20
- package/dist/lib/types/channel.d.ts +2 -105
- package/dist/lib/types/emoji.d.ts +0 -9
- package/dist/lib/types/entitlements.d.ts +0 -5
- package/dist/lib/types/guild-scheduled-event.d.ts +0 -23
- package/dist/lib/types/guild-template.d.ts +0 -12
- package/dist/lib/types/guild.d.ts +2 -160
- package/dist/lib/types/interaction.d.ts +12 -5
- package/dist/lib/types/stage-instance.d.ts +0 -11
- package/dist/lib/types/sticker.d.ts +0 -12
- package/dist/lib/types/user.d.ts +2 -26
- package/dist/lib/types/webhook.d.ts +2 -38
- package/dist/lib/utils/Util.d.ts +92 -2
- package/dist/lib/utils/Util.js +2207 -29
- package/dist/package.json +1 -1
- package/package.json +1 -1
@@ -107,7 +107,7 @@ class Shard {
|
|
107
107
|
case "READY":
|
108
108
|
{
|
109
109
|
this.sessionId = packet.d.session_id;
|
110
|
-
this.client.user = this.client.util.
|
110
|
+
this.client.user = this.client.util.userFromRaw(packet.d.user);
|
111
111
|
this.client.guilds = new Map();
|
112
112
|
this.client.application = packet.d.application;
|
113
113
|
this.client.emit(constants_1.GatewayEvents.Ready);
|
@@ -117,126 +117,214 @@ class Shard {
|
|
117
117
|
this.client.emit(constants_1.GatewayEvents.Resumed);
|
118
118
|
break;
|
119
119
|
case "APPLICATION_COMMAND_PERMISSIONS_UPDATE":
|
120
|
-
this.client.emit(constants_1.GatewayEvents.ApplicationCommandPermissionsUpdate, this.client.util.
|
120
|
+
this.client.emit(constants_1.GatewayEvents.ApplicationCommandPermissionsUpdate, this.client.util.guildApplicationCommandPermissionsFromRaw(packet.d));
|
121
121
|
break;
|
122
122
|
case "AUTO_MODERATION_RULE_CREATE":
|
123
|
-
this.client.emit(constants_1.GatewayEvents.AutoModerationRuleCreate, this.client.util.
|
123
|
+
this.client.emit(constants_1.GatewayEvents.AutoModerationRuleCreate, this.client.util.autoModerationRuleFromRaw(packet.d));
|
124
124
|
break;
|
125
125
|
case "AUTO_MODERATION_RULE_UPDATE":
|
126
|
-
this.client.emit(constants_1.GatewayEvents.AutoModerationRuleUpdate, this.client.util.
|
126
|
+
this.client.emit(constants_1.GatewayEvents.AutoModerationRuleUpdate, this.client.util.autoModerationRuleFromRaw(packet.d));
|
127
127
|
break;
|
128
128
|
case "AUTO_MODERATION_RULE_DELETE":
|
129
|
-
this.client.emit(constants_1.GatewayEvents.AutoModerationRuleDelete, this.client.util.
|
129
|
+
this.client.emit(constants_1.GatewayEvents.AutoModerationRuleDelete, this.client.util.autoModerationRuleFromRaw(packet.d));
|
130
130
|
break;
|
131
131
|
case "AUTO_MODERATION_ACTION_EXECUTION":
|
132
|
-
this.client.emit(constants_1.GatewayEvents.AutoModerationActionExecution,
|
132
|
+
this.client.emit(constants_1.GatewayEvents.AutoModerationActionExecution, {
|
133
|
+
guildId: packet.d.guild_id,
|
134
|
+
action: {
|
135
|
+
type: packet.d.action.type,
|
136
|
+
metadata: {
|
137
|
+
channelId: packet.d.action.metadata.channel_id,
|
138
|
+
durationSeconds: packet.d.action.metadata.duration_seconds,
|
139
|
+
customMessage: packet.d.action.metadata.custom_message,
|
140
|
+
},
|
141
|
+
},
|
142
|
+
ruleId: packet.d.rule_id,
|
143
|
+
ruleTriggerType: packet.d.rule_trigger_type,
|
144
|
+
userId: packet.d.user_id,
|
145
|
+
channelId: packet.d.channel_id,
|
146
|
+
messageId: packet.d.message_id,
|
147
|
+
alertSystemMessageId: packet.d.alert_system_message_id,
|
148
|
+
content: packet.d.content,
|
149
|
+
matchedKeyword: packet.d.matched_keyword,
|
150
|
+
matchedContent: packet.d.matched_content,
|
151
|
+
});
|
133
152
|
break;
|
134
153
|
case "CHANNEL_CREATE":
|
135
|
-
this.client.emit(constants_1.GatewayEvents.ChannelCreate, this.client.util.
|
154
|
+
this.client.emit(constants_1.GatewayEvents.ChannelCreate, this.client.util.channelFromRaw(packet.d));
|
136
155
|
break;
|
137
156
|
case "CHANNEL_UPDATE":
|
138
|
-
this.client.emit(constants_1.GatewayEvents.ChannelUpdate, this.client.util.
|
157
|
+
this.client.emit(constants_1.GatewayEvents.ChannelUpdate, this.client.util.channelFromRaw(packet.d));
|
139
158
|
break;
|
140
159
|
case "CHANNEL_DELETE":
|
141
|
-
this.client.emit(constants_1.GatewayEvents.ChannelDelete, this.client.util.
|
160
|
+
this.client.emit(constants_1.GatewayEvents.ChannelDelete, this.client.util.channelFromRaw(packet.d));
|
142
161
|
break;
|
143
162
|
case "CHANNEL_PINS_UPDATE":
|
144
|
-
this.client.emit(constants_1.GatewayEvents.ChannelPinsUpdate,
|
163
|
+
this.client.emit(constants_1.GatewayEvents.ChannelPinsUpdate, {
|
164
|
+
guildId: packet.d.guild_id,
|
165
|
+
channelId: packet.d.channel_id,
|
166
|
+
lastPinTimestamp: packet.d.last_pin_timestamp,
|
167
|
+
});
|
145
168
|
break;
|
146
169
|
case "THREAD_CREATE":
|
147
|
-
this.client.emit(constants_1.GatewayEvents.ThreadCreate, this.client.util.
|
170
|
+
this.client.emit(constants_1.GatewayEvents.ThreadCreate, this.client.util.channelFromRaw(packet.d));
|
148
171
|
break;
|
149
172
|
case "THREAD_UPDATE":
|
150
|
-
this.client.emit(constants_1.GatewayEvents.ThreadUpdate, this.client.util.
|
173
|
+
this.client.emit(constants_1.GatewayEvents.ThreadUpdate, this.client.util.channelFromRaw(packet.d));
|
151
174
|
break;
|
152
175
|
case "THREAD_DELETE":
|
153
|
-
this.client.emit(constants_1.GatewayEvents.ThreadDelete, this.client.util.
|
176
|
+
this.client.emit(constants_1.GatewayEvents.ThreadDelete, this.client.util.channelFromRaw(packet.d));
|
154
177
|
break;
|
155
178
|
case "THREAD_LIST_SYNC":
|
156
|
-
this.client.emit(constants_1.GatewayEvents.ThreadListSync,
|
179
|
+
this.client.emit(constants_1.GatewayEvents.ThreadListSync, {
|
180
|
+
guildId: packet.d.guild_id,
|
181
|
+
channelIds: packet.d.channel_ids,
|
182
|
+
threads: packet.d.threads.map((thread) => this.client.util.channelFromRaw(thread)),
|
183
|
+
members: packet.d.members.map((threadMember) => this.client.util.threadMemberFromRaw(threadMember)),
|
184
|
+
});
|
157
185
|
break;
|
158
186
|
case "THREAD_MEMBER_UPDATE":
|
159
|
-
this.client.emit(constants_1.GatewayEvents.ThreadMemberUpdate,
|
187
|
+
this.client.emit(constants_1.GatewayEvents.ThreadMemberUpdate, {
|
188
|
+
id: packet.d.id,
|
189
|
+
userId: packet.d.user_id,
|
190
|
+
joinTimestamp: packet.d.join_timestamp,
|
191
|
+
flags: packet.d.flags,
|
192
|
+
member: packet.d.member !== undefined
|
193
|
+
? this.client.util.guildMemberFromRaw(packet.d.member)
|
194
|
+
: undefined,
|
195
|
+
guildId: packet.d.guild_id,
|
196
|
+
});
|
160
197
|
break;
|
161
198
|
case "THREAD_MEMBERS_UPDATE":
|
162
|
-
this.client.emit(constants_1.GatewayEvents.ThreadMembersUpdate,
|
199
|
+
this.client.emit(constants_1.GatewayEvents.ThreadMembersUpdate, {
|
200
|
+
id: packet.d.id,
|
201
|
+
guildId: packet.d.guild_id,
|
202
|
+
memberCount: packet.d.member_count,
|
203
|
+
addedMembers: packet.d.members.map((threadMember) => this.client.util.threadMemberFromRaw(threadMember)),
|
204
|
+
removedMemberIds: packet.d.removed_member_ids,
|
205
|
+
});
|
163
206
|
break;
|
164
207
|
case "ENTITLEMENT_CREATE":
|
165
|
-
this.client.emit(constants_1.GatewayEvents.EntitlementCreate, this.client.util.
|
208
|
+
this.client.emit(constants_1.GatewayEvents.EntitlementCreate, this.client.util.entitlementFromRaw(packet.d));
|
166
209
|
break;
|
167
210
|
case "ENTITLEMENT_UPDATE":
|
168
|
-
this.client.emit(constants_1.GatewayEvents.EntitlementUpdate, this.client.util.
|
211
|
+
this.client.emit(constants_1.GatewayEvents.EntitlementUpdate, this.client.util.entitlementFromRaw(packet.d));
|
169
212
|
break;
|
170
213
|
case "ENTITLEMENT_DELETE":
|
171
|
-
this.client.emit(constants_1.GatewayEvents.EntitlementDelete, this.client.util.
|
214
|
+
this.client.emit(constants_1.GatewayEvents.EntitlementDelete, this.client.util.entitlementFromRaw(packet.d));
|
172
215
|
break;
|
173
216
|
case "GUILD_CREATE":
|
174
217
|
{
|
175
218
|
this.client.guildShardMap[packet.d.id] = this.id;
|
176
|
-
this.client.guilds.set(packet.d.id, this.client.util.
|
177
|
-
this.client.emit(constants_1.GatewayEvents.GuildCreate, this.client.util.
|
219
|
+
this.client.guilds.set(packet.d.id, this.client.util.guildFromRaw(packet.d));
|
220
|
+
this.client.emit(constants_1.GatewayEvents.GuildCreate, this.client.util.guildFromRaw(packet.d));
|
178
221
|
}
|
179
222
|
break;
|
180
223
|
case "GUILD_UPDATE":
|
181
224
|
{
|
182
|
-
this.client.guilds.set(packet.d.id, this.client.util.
|
183
|
-
this.client.emit(constants_1.GatewayEvents.GuildUpdate, this.client.util.
|
225
|
+
this.client.guilds.set(packet.d.id, this.client.util.guildFromRaw(packet.d));
|
226
|
+
this.client.emit(constants_1.GatewayEvents.GuildUpdate, this.client.util.guildFromRaw(packet.d));
|
184
227
|
}
|
185
228
|
break;
|
186
229
|
case "GUILD_DELETE":
|
187
230
|
{
|
188
231
|
delete this.client.guildShardMap[packet.d.id];
|
189
232
|
this.client.guilds.delete(packet.d.id);
|
190
|
-
this.client.emit(constants_1.GatewayEvents.GuildDelete,
|
233
|
+
this.client.emit(constants_1.GatewayEvents.GuildDelete, {
|
234
|
+
id: packet.d.id,
|
235
|
+
unavailable: packet.d.unavailable,
|
236
|
+
});
|
191
237
|
}
|
192
238
|
break;
|
193
239
|
case "GUILD_AUDIT_LOG_ENTRY_CREATE":
|
194
|
-
this.client.emit(constants_1.GatewayEvents.GuildAuditLogEntryCreate,
|
240
|
+
this.client.emit(constants_1.GatewayEvents.GuildAuditLogEntryCreate, {
|
241
|
+
...this.client.util.auditLogEntryFromRaw(packet.d),
|
242
|
+
guildId: packet.d.guild_id,
|
243
|
+
});
|
195
244
|
break;
|
196
245
|
case "GUILD_BAN_ADD":
|
197
|
-
this.client.emit(constants_1.GatewayEvents.GuildBanAdd,
|
246
|
+
this.client.emit(constants_1.GatewayEvents.GuildBanAdd, {
|
247
|
+
guildId: packet.d.guild_id,
|
248
|
+
user: this.client.util.userFromRaw(packet.d.user),
|
249
|
+
});
|
198
250
|
break;
|
199
251
|
case "GUILD_BAN_REMOVE":
|
200
|
-
this.client.emit(constants_1.GatewayEvents.GuildBanRemove,
|
252
|
+
this.client.emit(constants_1.GatewayEvents.GuildBanRemove, {
|
253
|
+
guildId: packet.d.guild_id,
|
254
|
+
user: this.client.util.userFromRaw(packet.d.user),
|
255
|
+
});
|
201
256
|
break;
|
202
257
|
case "GUILD_EMOJIS_UPDATE":
|
203
|
-
this.client.emit(constants_1.GatewayEvents.GuildEmojisUpdate, packet.d.emojis.map((emoji) => this.client.util.
|
258
|
+
this.client.emit(constants_1.GatewayEvents.GuildEmojisUpdate, packet.d.emojis.map((emoji) => this.client.util.emojiFromRaw(emoji)), packet.d.guild_id);
|
204
259
|
break;
|
205
260
|
case "GUILD_STICKERS_UPDATE":
|
206
|
-
this.client.emit(constants_1.GatewayEvents.GuildStickersUpdate, packet.d.stickers.map((sticker) => this.client.util.
|
261
|
+
this.client.emit(constants_1.GatewayEvents.GuildStickersUpdate, packet.d.stickers.map((sticker) => this.client.util.stickerFromRaw(sticker)), packet.d.guild_id);
|
207
262
|
break;
|
208
263
|
case "GUILD_INTEGRATIONS_UPDATE":
|
209
264
|
this.client.emit(constants_1.GatewayEvents.GuildIntegrationsUpdate, packet.d.guild_id);
|
210
265
|
break;
|
211
266
|
case "GUILD_MEMBER_ADD":
|
212
|
-
this.client.emit(constants_1.GatewayEvents.GuildMemberAdd,
|
267
|
+
this.client.emit(constants_1.GatewayEvents.GuildMemberAdd, {
|
268
|
+
...this.client.util.guildMemberFromRaw(packet.d),
|
269
|
+
guildId: packet.d.guild_id,
|
270
|
+
});
|
213
271
|
break;
|
214
272
|
case "GUILD_MEMBER_REMOVE":
|
215
|
-
this.client.emit(constants_1.GatewayEvents.GuildMemberRemove,
|
273
|
+
this.client.emit(constants_1.GatewayEvents.GuildMemberRemove, {
|
274
|
+
guildId: packet.d.guild_id,
|
275
|
+
user: this.client.util.userFromRaw(packet.d.user),
|
276
|
+
});
|
216
277
|
break;
|
217
278
|
case "GUILD_MEMBER_UPDATE":
|
218
|
-
this.client.emit(constants_1.GatewayEvents.GuildMemberUpdate,
|
279
|
+
this.client.emit(constants_1.GatewayEvents.GuildMemberUpdate, {
|
280
|
+
guildId: packet.d.guild_id,
|
281
|
+
roles: packet.d.roles,
|
282
|
+
user: this.client.util.userFromRaw(packet.d.user),
|
283
|
+
nick: packet.d.nick,
|
284
|
+
avatar: packet.d.avatar,
|
285
|
+
joinedAt: packet.d.joined_at,
|
286
|
+
premiumSince: packet.d.premium_since,
|
287
|
+
deaf: packet.d.deaf,
|
288
|
+
mute: packet.d.mute,
|
289
|
+
pending: packet.d.pending,
|
290
|
+
communicationDisabledUntil: packet.d.communication_disabled_until,
|
291
|
+
flags: packet.d.flags,
|
292
|
+
avatarDecorationData: packet.d.avatar_decoration_data !== undefined
|
293
|
+
? {
|
294
|
+
asset: packet.d.asset,
|
295
|
+
skuId: packet.d.sku_id,
|
296
|
+
}
|
297
|
+
: undefined,
|
298
|
+
});
|
219
299
|
break;
|
220
300
|
case "GUILD_MEMBERS_CHUNK":
|
221
|
-
this.client.emit(constants_1.GatewayEvents.GuildMembersChunk,
|
301
|
+
this.client.emit(constants_1.GatewayEvents.GuildMembersChunk, {
|
302
|
+
guildId: packet.d.guild_id,
|
303
|
+
members: packet.d.members.map((guildMember) => this.client.util.guildMemberFromRaw(guildMember)),
|
304
|
+
chunkIndex: packet.d.chunk_index,
|
305
|
+
chunkCount: packet.d.chunk_count,
|
306
|
+
notFound: packet.d.not_found,
|
307
|
+
presences: packet.d.presences?.map((presence) => this.client.util.presenceFromRaw(presence)),
|
308
|
+
nonce: packet.d.nonce,
|
309
|
+
});
|
222
310
|
break;
|
223
311
|
case "GUILD_ROLE_CREATE":
|
224
|
-
this.client.emit(constants_1.GatewayEvents.GuildRoleCreate, this.client.util.
|
312
|
+
this.client.emit(constants_1.GatewayEvents.GuildRoleCreate, this.client.util.roleFromRaw(packet.d.role), packet.d.guild_id);
|
225
313
|
break;
|
226
314
|
case "GUILD_ROLE_UPDATE":
|
227
|
-
this.client.emit(constants_1.GatewayEvents.GuildRoleUpdate, this.client.util.
|
315
|
+
this.client.emit(constants_1.GatewayEvents.GuildRoleUpdate, this.client.util.roleFromRaw(packet.d.role), packet.d.guild_id);
|
228
316
|
break;
|
229
317
|
case "GUILD_ROLE_DELETE":
|
230
318
|
this.client.emit(constants_1.GatewayEvents.GuildRoleDelete, packet.d.role_id, packet.d.guild_id);
|
231
319
|
break;
|
232
320
|
case "GUILD_SCHEDULED_EVENT_CREATE":
|
233
|
-
this.client.emit(constants_1.GatewayEvents.GuildScheduledEventCreate, this.client.util.
|
321
|
+
this.client.emit(constants_1.GatewayEvents.GuildScheduledEventCreate, this.client.util.guildScheduledEventFromRaw(packet.d));
|
234
322
|
break;
|
235
323
|
case "GUILD_SCHEDULED_EVENT_UPDATE":
|
236
|
-
this.client.emit(constants_1.GatewayEvents.GuildScheduledEventUpdate, this.client.util.
|
324
|
+
this.client.emit(constants_1.GatewayEvents.GuildScheduledEventUpdate, this.client.util.guildScheduledEventFromRaw(packet.d));
|
237
325
|
break;
|
238
326
|
case "GUILD_SCHEDULED_EVENT_DELETE":
|
239
|
-
this.client.emit(constants_1.GatewayEvents.GuildScheduledEventDelete, this.client.util.
|
327
|
+
this.client.emit(constants_1.GatewayEvents.GuildScheduledEventDelete, this.client.util.guildScheduledEventFromRaw(packet.d));
|
240
328
|
break;
|
241
329
|
case "GUILD_SCHEDULED_EVENT_USER_ADD":
|
242
330
|
this.client.emit(constants_1.GatewayEvents.GuildScheduledEventUserAdd, packet.d.user_id, packet.d.guild_scheduled_event_id, packet.d.guild_id);
|
@@ -245,79 +333,181 @@ class Shard {
|
|
245
333
|
this.client.emit(constants_1.GatewayEvents.GuildScheduledEventUserRemove, packet.d.user_id, packet.d.guild_scheduled_event_id, packet.d.guild_id);
|
246
334
|
break;
|
247
335
|
case "INTEGRATION_CREATE":
|
248
|
-
this.client.emit(constants_1.GatewayEvents.IntegrationCreate,
|
336
|
+
this.client.emit(constants_1.GatewayEvents.IntegrationCreate, {
|
337
|
+
...this.client.util.integrationFromRaw(packet.d),
|
338
|
+
guildId: packet.d.guild_id,
|
339
|
+
});
|
249
340
|
break;
|
250
341
|
case "INTEGRATION_UPDATE":
|
251
|
-
this.client.emit(constants_1.GatewayEvents.IntegrationUpdate,
|
342
|
+
this.client.emit(constants_1.GatewayEvents.IntegrationUpdate, {
|
343
|
+
...this.client.util.integrationFromRaw(packet.d),
|
344
|
+
guildId: packet.d.guild_id,
|
345
|
+
});
|
252
346
|
break;
|
253
347
|
case "INTEGRATION_DELETE":
|
254
|
-
this.client.emit(constants_1.GatewayEvents.IntegrationDelete,
|
348
|
+
this.client.emit(constants_1.GatewayEvents.IntegrationDelete, {
|
349
|
+
id: packet.d.id,
|
350
|
+
guildId: packet.d.guild_id,
|
351
|
+
applicationId: packet.d.application_id,
|
352
|
+
});
|
255
353
|
break;
|
256
354
|
case "INTERACTION_CREATE":
|
257
|
-
this.client.emit(constants_1.GatewayEvents.InteractionCreate, this.client.util.
|
355
|
+
this.client.emit(constants_1.GatewayEvents.InteractionCreate, this.client.util.interactionFromRaw(packet.d));
|
258
356
|
break;
|
259
357
|
case "INVITE_CREATE":
|
260
|
-
this.client.emit(constants_1.GatewayEvents.InviteCreate,
|
358
|
+
this.client.emit(constants_1.GatewayEvents.InviteCreate, {
|
359
|
+
channelId: packet.d.channel_id,
|
360
|
+
code: packet.d.code,
|
361
|
+
createdAt: packet.d.created_at,
|
362
|
+
guildId: packet.d.guild_id,
|
363
|
+
inviter: packet.d.inviter !== undefined
|
364
|
+
? this.client.util.userFromRaw(packet.d.inviter)
|
365
|
+
: undefined,
|
366
|
+
maxAge: packet.d.max_age,
|
367
|
+
maxUses: packet.d.max_uses,
|
368
|
+
targetType: packet.d.target_type,
|
369
|
+
targetUser: packet.d.target_user !== undefined
|
370
|
+
? this.client.util.userFromRaw(packet.d.target_user)
|
371
|
+
: undefined,
|
372
|
+
targetApplication: packet.d.target_application !== undefined
|
373
|
+
? this.client.util.applicationFromRaw(packet.d.target_application)
|
374
|
+
: undefined,
|
375
|
+
temporary: packet.d.temporary,
|
376
|
+
uses: packet.d.uses,
|
377
|
+
});
|
261
378
|
break;
|
262
379
|
case "INVITE_DELETE":
|
263
|
-
this.client.emit(constants_1.GatewayEvents.InviteDelete,
|
380
|
+
this.client.emit(constants_1.GatewayEvents.InviteDelete, {
|
381
|
+
channelId: packet.d.channel_id,
|
382
|
+
guildId: packet.d.guild_id,
|
383
|
+
code: packet.d.code,
|
384
|
+
});
|
264
385
|
break;
|
265
386
|
case "MESSAGE_CREATE":
|
266
|
-
this.client.emit(constants_1.GatewayEvents.MessageCreate,
|
387
|
+
this.client.emit(constants_1.GatewayEvents.MessageCreate, {
|
388
|
+
...this.client.util.messageFromRaw(packet.d),
|
389
|
+
guildId: packet.d.guild_id,
|
390
|
+
member: packet.d.member !== undefined
|
391
|
+
? this.client.util.guildMemberFromRaw(packet.d.member)
|
392
|
+
: undefined,
|
393
|
+
mentions: packet.d.mentions.map((mention) => this.client.util.userFromRaw(mention)),
|
394
|
+
});
|
267
395
|
break;
|
268
396
|
case "MESSAGE_UPDATE":
|
269
|
-
this.client.emit(constants_1.GatewayEvents.MessageUpdate, this.client.util.
|
397
|
+
this.client.emit(constants_1.GatewayEvents.MessageUpdate, this.client.util.messageFromRaw(packet.d));
|
270
398
|
break;
|
271
399
|
case "MESSAGE_DELETE":
|
272
|
-
this.client.emit(constants_1.GatewayEvents.MessageDelete,
|
400
|
+
this.client.emit(constants_1.GatewayEvents.MessageDelete, {
|
401
|
+
id: packet.d.id,
|
402
|
+
channelId: packet.d.channel_id,
|
403
|
+
guildId: packet.d.guild_id,
|
404
|
+
});
|
273
405
|
break;
|
274
406
|
case "MESSAGE_DELETE_BULK":
|
275
|
-
this.client.emit(constants_1.GatewayEvents.MessageDeleteBulk,
|
407
|
+
this.client.emit(constants_1.GatewayEvents.MessageDeleteBulk, {
|
408
|
+
ids: packet.d.ids,
|
409
|
+
channelId: packet.d.channel_id,
|
410
|
+
guildId: packet.d.guild_id,
|
411
|
+
});
|
276
412
|
break;
|
277
413
|
case "MESSAGE_REACTION_ADD":
|
278
|
-
this.client.emit(constants_1.GatewayEvents.MessageReactionAdd,
|
414
|
+
this.client.emit(constants_1.GatewayEvents.MessageReactionAdd, {
|
415
|
+
userId: packet.d.user_id,
|
416
|
+
channelId: packet.d.user_id,
|
417
|
+
messageId: packet.d.user_id,
|
418
|
+
guildId: packet.d.user_id,
|
419
|
+
member: packet.d.member !== undefined
|
420
|
+
? this.client.util.guildMemberFromRaw(packet.d.member)
|
421
|
+
: undefined,
|
422
|
+
emoji: this.client.util.emojiFromRaw(packet.d.emoji),
|
423
|
+
messageAuthorId: packet.d.message_author_id,
|
424
|
+
burst: packet.d.burst,
|
425
|
+
burstColors: packet.d.burst_colors,
|
426
|
+
type: packet.d.type,
|
427
|
+
});
|
279
428
|
break;
|
280
429
|
case "MESSAGE_REACTION_REMOVE":
|
281
|
-
this.client.emit(constants_1.GatewayEvents.MessageReactionRemove,
|
430
|
+
this.client.emit(constants_1.GatewayEvents.MessageReactionRemove, {
|
431
|
+
userId: packet.d.user_id,
|
432
|
+
channelId: packet.d.user_id,
|
433
|
+
messageId: packet.d.user_id,
|
434
|
+
guildId: packet.d.user_id,
|
435
|
+
emoji: this.client.util.emojiFromRaw(packet.d.emoji),
|
436
|
+
burst: packet.d.burst,
|
437
|
+
type: packet.d.type,
|
438
|
+
});
|
282
439
|
break;
|
283
440
|
case "MESSAGE_REACTION_REMOVE_ALL":
|
284
|
-
this.client.emit(constants_1.GatewayEvents.MessageReactionRemoveAll,
|
441
|
+
this.client.emit(constants_1.GatewayEvents.MessageReactionRemoveAll, {
|
442
|
+
channelId: packet.d.channel_id,
|
443
|
+
messageId: packet.d.message_id,
|
444
|
+
guildId: packet.d.guild_id,
|
445
|
+
});
|
285
446
|
break;
|
286
447
|
case "MESSAGE_REACTION_REMOVE_EMOJI":
|
287
|
-
this.client.emit(constants_1.GatewayEvents.MessageReactionRemoveEmoji,
|
448
|
+
this.client.emit(constants_1.GatewayEvents.MessageReactionRemoveEmoji, {
|
449
|
+
channelId: packet.d.channel_id,
|
450
|
+
guildId: packet.d.guild_id,
|
451
|
+
messageId: packet.d.message_id,
|
452
|
+
emoji: this.client.util.emojiFromRaw(packet.d.emoji),
|
453
|
+
});
|
288
454
|
break;
|
289
455
|
case "PRESENCE_UPDATE":
|
290
|
-
this.client.emit(constants_1.GatewayEvents.PresenceUpdate, this.client.util.
|
456
|
+
this.client.emit(constants_1.GatewayEvents.PresenceUpdate, this.client.util.presenceFromRaw(packet.d));
|
291
457
|
break;
|
292
458
|
case "STAGE_INSTANCE_CREATE":
|
293
|
-
this.client.emit(constants_1.GatewayEvents.StageInstanceCreate, this.client.util.
|
459
|
+
this.client.emit(constants_1.GatewayEvents.StageInstanceCreate, this.client.util.stageInstanceFromRaw(packet.d));
|
294
460
|
break;
|
295
461
|
case "STAGE_INSTANCE_UPDATE":
|
296
|
-
this.client.emit(constants_1.GatewayEvents.StageInstanceUpdate, this.client.util.
|
462
|
+
this.client.emit(constants_1.GatewayEvents.StageInstanceUpdate, this.client.util.stageInstanceFromRaw(packet.d));
|
297
463
|
break;
|
298
464
|
case "STAGE_INSTANCE_DELETE":
|
299
|
-
this.client.emit(constants_1.GatewayEvents.StageInstanceDelete, this.client.util.
|
465
|
+
this.client.emit(constants_1.GatewayEvents.StageInstanceDelete, this.client.util.stageInstanceFromRaw(packet.d));
|
300
466
|
break;
|
301
467
|
case "TYPING_START":
|
302
|
-
this.client.emit(constants_1.GatewayEvents.TypingStart,
|
468
|
+
this.client.emit(constants_1.GatewayEvents.TypingStart, {
|
469
|
+
channelId: packet.d.channel_id,
|
470
|
+
guildId: packet.d.guild_id,
|
471
|
+
userId: packet.d.user_id,
|
472
|
+
timestamp: packet.d.timestamp,
|
473
|
+
member: packet.d.member !== undefined
|
474
|
+
? this.client.util.guildMemberFromRaw(packet.d.member)
|
475
|
+
: undefined,
|
476
|
+
});
|
303
477
|
break;
|
304
478
|
case "USER_UPDATE":
|
305
|
-
this.client.emit(constants_1.GatewayEvents.UserUpdate, this.client.util.
|
479
|
+
this.client.emit(constants_1.GatewayEvents.UserUpdate, this.client.util.userFromRaw(packet.d));
|
306
480
|
break;
|
307
481
|
case "VOICE_STATE_UPDATE":
|
308
|
-
this.client.emit(constants_1.GatewayEvents.VoiceStateUpdate, this.client.util.
|
482
|
+
this.client.emit(constants_1.GatewayEvents.VoiceStateUpdate, this.client.util.voiceStateFromRaw(packet.d));
|
309
483
|
break;
|
310
484
|
case "VOICE_SERVER_UPDATE":
|
311
|
-
this.client.emit(constants_1.GatewayEvents.VoiceServerUpdate,
|
485
|
+
this.client.emit(constants_1.GatewayEvents.VoiceServerUpdate, {
|
486
|
+
token: packet.d.token,
|
487
|
+
guildId: packet.d.guild_id,
|
488
|
+
endpoint: packet.d.endpoint,
|
489
|
+
});
|
312
490
|
break;
|
313
491
|
case "WEBHOOKS_UPDATE":
|
314
492
|
this.client.emit(constants_1.GatewayEvents.WebhooksUpdate, packet.d.channel_id, packet.d.guild_id);
|
315
493
|
break;
|
316
494
|
case "MESSAGE_POLL_VOTE_ADD":
|
317
|
-
this.client.emit(constants_1.GatewayEvents.MessagePollVoteAdd,
|
495
|
+
this.client.emit(constants_1.GatewayEvents.MessagePollVoteAdd, {
|
496
|
+
userId: packet.d.user_id,
|
497
|
+
channelId: packet.d.channel_id,
|
498
|
+
messageId: packet.d.message_id,
|
499
|
+
guildId: packet.d.guild_id,
|
500
|
+
answerId: packet.d.answer_id,
|
501
|
+
});
|
318
502
|
break;
|
319
503
|
case "MESSAGE_POLL_VOTE_REMOVE":
|
320
|
-
this.client.emit(constants_1.GatewayEvents.MessagePollVoteRemove,
|
504
|
+
this.client.emit(constants_1.GatewayEvents.MessagePollVoteRemove, {
|
505
|
+
userId: packet.d.user_id,
|
506
|
+
channelId: packet.d.channel_id,
|
507
|
+
messageId: packet.d.message_id,
|
508
|
+
guildId: packet.d.guild_id,
|
509
|
+
answerId: packet.d.answer_id,
|
510
|
+
});
|
321
511
|
break;
|
322
512
|
}
|
323
513
|
}
|
package/dist/lib/index.d.ts
CHANGED
@@ -1,5 +1,30 @@
|
|
1
1
|
export * from "./gateway";
|
2
2
|
export * from "./rest";
|
3
|
+
export * from "./types/application-command";
|
4
|
+
export * from "./types/application-role-connection-metadata";
|
5
|
+
export * from "./types/application";
|
6
|
+
export * from "./types/audit-log";
|
7
|
+
export * from "./types/auto-moderation";
|
8
|
+
export * from "./types/channel";
|
9
|
+
export * from "./types/common";
|
10
|
+
export * from "./types/emoji";
|
11
|
+
export * from "./types/entitlements";
|
12
|
+
export * from "./types/gateway-events";
|
13
|
+
export * from "./types/guild-scheduled-event";
|
14
|
+
export * from "./types/guild-template";
|
15
|
+
export * from "./types/guild";
|
16
|
+
export * from "./types/interaction";
|
17
|
+
export * from "./types/invite";
|
18
|
+
export * from "./types/message-components";
|
19
|
+
export * from "./types/poll";
|
20
|
+
export * from "./types/role";
|
21
|
+
export * from "./types/sku";
|
22
|
+
export * from "./types/stage-instance";
|
23
|
+
export * from "./types/sticker";
|
24
|
+
export * from "./types/team";
|
25
|
+
export * from "./types/user";
|
26
|
+
export * from "./types/voice";
|
27
|
+
export * from "./types/webhook";
|
3
28
|
export * from "./utils";
|
4
29
|
export * from "./Client";
|
5
30
|
export * from "./constants";
|
package/dist/lib/index.js
CHANGED
@@ -16,6 +16,31 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
17
|
__exportStar(require("./gateway"), exports);
|
18
18
|
__exportStar(require("./rest"), exports);
|
19
|
+
__exportStar(require("./types/application-command"), exports);
|
20
|
+
__exportStar(require("./types/application-role-connection-metadata"), exports);
|
21
|
+
__exportStar(require("./types/application"), exports);
|
22
|
+
__exportStar(require("./types/audit-log"), exports);
|
23
|
+
__exportStar(require("./types/auto-moderation"), exports);
|
24
|
+
__exportStar(require("./types/channel"), exports);
|
25
|
+
__exportStar(require("./types/common"), exports);
|
26
|
+
__exportStar(require("./types/emoji"), exports);
|
27
|
+
__exportStar(require("./types/entitlements"), exports);
|
28
|
+
__exportStar(require("./types/gateway-events"), exports);
|
29
|
+
__exportStar(require("./types/guild-scheduled-event"), exports);
|
30
|
+
__exportStar(require("./types/guild-template"), exports);
|
31
|
+
__exportStar(require("./types/guild"), exports);
|
32
|
+
__exportStar(require("./types/interaction"), exports);
|
33
|
+
__exportStar(require("./types/invite"), exports);
|
34
|
+
__exportStar(require("./types/message-components"), exports);
|
35
|
+
__exportStar(require("./types/poll"), exports);
|
36
|
+
__exportStar(require("./types/role"), exports);
|
37
|
+
__exportStar(require("./types/sku"), exports);
|
38
|
+
__exportStar(require("./types/stage-instance"), exports);
|
39
|
+
__exportStar(require("./types/sticker"), exports);
|
40
|
+
__exportStar(require("./types/team"), exports);
|
41
|
+
__exportStar(require("./types/user"), exports);
|
42
|
+
__exportStar(require("./types/voice"), exports);
|
43
|
+
__exportStar(require("./types/webhook"), exports);
|
19
44
|
__exportStar(require("./utils"), exports);
|
20
45
|
__exportStar(require("./Client"), exports);
|
21
46
|
__exportStar(require("./constants"), exports);
|
@@ -105,76 +105,3 @@ export interface ApplicationCommandPermission {
|
|
105
105
|
type: ApplicationCommandPermissionType;
|
106
106
|
permission: boolean;
|
107
107
|
}
|
108
|
-
export interface CreateGlobalApplicationCommandParams {
|
109
|
-
name: string;
|
110
|
-
nameLocalizations?: LocaleMap | null;
|
111
|
-
description?: string;
|
112
|
-
descriptionLocalizations?: LocaleMap | null;
|
113
|
-
options?: Array<ApplicationCommandOption>;
|
114
|
-
defaultMemberPermissions?: string | null;
|
115
|
-
dmPermission?: boolean;
|
116
|
-
defaultPermission?: boolean | null;
|
117
|
-
type?: ApplicationCommandTypes;
|
118
|
-
nsfw?: boolean;
|
119
|
-
}
|
120
|
-
export interface EditGlobalApplicationCommandParams {
|
121
|
-
name?: string;
|
122
|
-
nameLocalizations?: LocaleMap | null;
|
123
|
-
description?: string;
|
124
|
-
descriptionLocalizations?: LocaleMap | null;
|
125
|
-
options?: Array<ApplicationCommandOption>;
|
126
|
-
defaultMemberPermissions?: string | null;
|
127
|
-
defaultPermission?: boolean | null;
|
128
|
-
dmPermission?: boolean;
|
129
|
-
nsfw?: boolean;
|
130
|
-
}
|
131
|
-
export type BulkEditGlobalApplicationCommandsParams = Array<{
|
132
|
-
id?: snowflake;
|
133
|
-
name: string;
|
134
|
-
nameLocalizations?: LocaleMap | null;
|
135
|
-
description?: string;
|
136
|
-
descriptionLocalizations?: LocaleMap | null;
|
137
|
-
options?: Array<ApplicationCommandOption>;
|
138
|
-
defaultMemberPermissions?: string | null;
|
139
|
-
dmPermission?: boolean;
|
140
|
-
defaultPermission?: boolean | null;
|
141
|
-
type?: ApplicationCommandTypes;
|
142
|
-
nsfw?: boolean;
|
143
|
-
}>;
|
144
|
-
export interface CreateGuildApplicationCommandParams {
|
145
|
-
name: string;
|
146
|
-
nameLocalizations?: LocaleMap | null;
|
147
|
-
description?: string;
|
148
|
-
descriptionLocalizations?: LocaleMap | null;
|
149
|
-
options?: Array<ApplicationCommandOption>;
|
150
|
-
defaultMemberPermissions?: string | null;
|
151
|
-
defaultPermission?: boolean | null;
|
152
|
-
type?: ApplicationCommandTypes;
|
153
|
-
nsfw?: boolean;
|
154
|
-
}
|
155
|
-
export interface EditGuildApplicationCommandParams {
|
156
|
-
name?: string;
|
157
|
-
nameLocalizations?: LocaleMap | null;
|
158
|
-
description?: string;
|
159
|
-
descriptionLocalizations?: LocaleMap | null;
|
160
|
-
options?: Array<ApplicationCommandOption>;
|
161
|
-
defaultMemberPermissions?: string | null;
|
162
|
-
defaultPermission?: boolean | null;
|
163
|
-
nsfw?: boolean;
|
164
|
-
}
|
165
|
-
export type BulkEditGuildApplicationCommandsParams = Array<{
|
166
|
-
id?: snowflake;
|
167
|
-
name: string;
|
168
|
-
nameLocalizations?: LocaleMap | null;
|
169
|
-
description?: string;
|
170
|
-
descriptionLocalizations?: LocaleMap | null;
|
171
|
-
options?: Array<ApplicationCommandOption>;
|
172
|
-
defaultMemberPermissions?: string | null;
|
173
|
-
dmPermission?: boolean;
|
174
|
-
defaultPermission?: boolean | null;
|
175
|
-
type: ApplicationCommandTypes;
|
176
|
-
nsfw?: boolean;
|
177
|
-
}>;
|
178
|
-
export interface EditApplicationCommandPermissionsParams {
|
179
|
-
permissions: Array<GuildApplicationCommandPermissions>;
|
180
|
-
}
|
@@ -76,15 +76,3 @@ export interface InstallParams {
|
|
76
76
|
scopes: Array<OAuth2Scopes>;
|
77
77
|
permissions: string;
|
78
78
|
}
|
79
|
-
export interface EditCurrentApplicationParams {
|
80
|
-
customInstallUrl?: string;
|
81
|
-
description?: string;
|
82
|
-
roleConnectionsVerificationUrl?: string;
|
83
|
-
installParams?: InstallParams;
|
84
|
-
integrationTypesConfig?: Record<ApplicationIntegrationTypes, ApplicationIntegrationTypeConfiguration>;
|
85
|
-
flags?: ApplicationFlags;
|
86
|
-
icon?: string;
|
87
|
-
coverImage?: string;
|
88
|
-
interactionsEndpointUrl?: string;
|
89
|
-
tags?: Array<string>;
|
90
|
-
}
|
@@ -64,23 +64,3 @@ export interface ActionMetadata {
|
|
64
64
|
durationSeconds: number;
|
65
65
|
customMessage?: string;
|
66
66
|
}
|
67
|
-
export interface CreateAutoModerationRuleParams {
|
68
|
-
name: string;
|
69
|
-
eventType: EventTypes;
|
70
|
-
triggerType: TriggerTypes;
|
71
|
-
triggerMetadata?: TriggerMetadata;
|
72
|
-
actions: Array<AutoModerationAction>;
|
73
|
-
enabled?: boolean;
|
74
|
-
exemptRoles?: Array<string>;
|
75
|
-
exemptChannels?: Array<string>;
|
76
|
-
}
|
77
|
-
export interface EditAutoModerationRuleParams {
|
78
|
-
name?: string;
|
79
|
-
eventType?: EventTypes;
|
80
|
-
triggerType?: TriggerTypes;
|
81
|
-
triggerMetadata?: TriggerMetadata;
|
82
|
-
actions?: Array<AutoModerationAction>;
|
83
|
-
enabled?: boolean;
|
84
|
-
exemptRoles?: Array<string>;
|
85
|
-
exemptChannels?: Array<string>;
|
86
|
-
}
|