disgroove 2.2.2-dev.db6cb16 → 2.2.3-dev.4f98e3d
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/README.md +5 -9
- package/dist/lib/Client.d.ts +116 -126
- package/dist/lib/Client.js +360 -267
- package/dist/lib/constants.d.ts +85 -74
- package/dist/lib/constants.js +88 -75
- package/dist/lib/gateway/Shard.d.ts +1 -0
- package/dist/lib/gateway/Shard.js +194 -170
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/lib/rest/Endpoints.d.ts +6 -6
- package/dist/lib/rest/Endpoints.js +13 -13
- package/dist/lib/rest/RequestManager.d.ts +1 -1
- package/dist/lib/rest/RequestManager.js +1 -1
- package/dist/lib/rest/index.d.ts +0 -1
- package/dist/lib/rest/index.js +1 -2
- package/dist/lib/transformers/ApplicationCommands.d.ts +7 -0
- package/dist/lib/transformers/ApplicationCommands.js +90 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.d.ts +5 -0
- package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.js +26 -0
- package/dist/lib/transformers/Applications.d.ts +5 -0
- package/dist/lib/transformers/Applications.js +97 -0
- package/dist/lib/transformers/AuditLogs.d.ts +7 -0
- package/dist/lib/transformers/AuditLogs.js +97 -0
- package/dist/lib/transformers/AutoModeration.d.ts +9 -0
- package/dist/lib/transformers/AutoModeration.js +76 -0
- package/dist/lib/transformers/Channels.d.ts +16 -0
- package/dist/lib/transformers/Channels.js +676 -0
- package/dist/lib/transformers/Emojis.d.ts +5 -0
- package/dist/lib/transformers/Emojis.js +31 -0
- package/dist/lib/transformers/Entitlements.d.ts +7 -0
- package/dist/lib/transformers/Entitlements.js +58 -0
- package/dist/lib/transformers/GuildScheduledEvents.d.ts +5 -0
- package/dist/lib/transformers/GuildScheduledEvents.js +51 -0
- package/dist/lib/transformers/GuildTemplates.d.ts +5 -0
- package/dist/lib/transformers/GuildTemplates.js +38 -0
- package/dist/lib/transformers/Guilds.d.ts +12 -0
- package/dist/lib/transformers/Guilds.js +264 -0
- package/dist/lib/transformers/Interactions.d.ts +10 -0
- package/dist/lib/transformers/Interactions.js +273 -0
- package/dist/lib/transformers/Invites.d.ts +5 -0
- package/dist/lib/transformers/Invites.js +79 -0
- package/dist/lib/transformers/Polls.d.ts +5 -0
- package/dist/lib/transformers/Polls.js +50 -0
- package/dist/lib/transformers/Presences.d.ts +5 -0
- package/dist/lib/transformers/Presences.js +116 -0
- package/dist/lib/transformers/Roles.d.ts +5 -0
- package/dist/lib/transformers/Roles.js +56 -0
- package/dist/lib/transformers/SKUs.d.ts +5 -0
- package/dist/lib/transformers/SKUs.js +26 -0
- package/dist/lib/transformers/StageInstances.d.ts +5 -0
- package/dist/lib/transformers/StageInstances.js +28 -0
- package/dist/lib/transformers/Stickers.d.ts +5 -0
- package/dist/lib/transformers/Stickers.js +41 -0
- package/dist/lib/transformers/Teams.d.ts +5 -0
- package/dist/lib/transformers/Teams.js +35 -0
- package/dist/lib/transformers/Users.d.ts +5 -0
- package/dist/lib/transformers/Users.js +62 -0
- package/dist/lib/transformers/Voice.d.ts +5 -0
- package/dist/lib/transformers/Voice.js +45 -0
- package/dist/lib/transformers/Webhooks.d.ts +5 -0
- package/dist/lib/transformers/Webhooks.js +51 -0
- package/dist/lib/transformers/index.d.ts +23 -0
- package/dist/lib/transformers/index.js +39 -0
- package/dist/lib/types/entitlements.d.ts +0 -6
- package/dist/lib/types/gateway-events.d.ts +21 -8
- package/dist/lib/types/guild.d.ts +3 -1
- package/dist/lib/types/interaction.d.ts +2 -2
- package/dist/lib/types/sku.d.ts +0 -12
- package/dist/lib/types/user.d.ts +2 -2
- package/dist/lib/utils/CDN.d.ts +24 -0
- package/dist/lib/utils/CDN.js +49 -0
- package/dist/lib/utils/errors.d.ts +3 -3
- package/dist/lib/utils/errors.js +10 -12
- package/dist/lib/utils/formatters.d.ts +16 -0
- package/dist/lib/utils/formatters.js +44 -0
- package/dist/lib/utils/index.d.ts +2 -1
- package/dist/lib/utils/index.js +15 -1
- package/dist/package.json +3 -3
- package/package.json +3 -3
- package/dist/lib/rest/CDN.d.ts +0 -22
- package/dist/lib/rest/CDN.js +0 -45
- package/dist/lib/types/voice-connections.d.ts +0 -64
- package/dist/lib/types/voice-connections.js +0 -2
- package/dist/lib/utils/Util.d.ts +0 -94
- package/dist/lib/utils/Util.js +0 -2228
- package/dist/lib/voice/VoiceConnection.d.ts +0 -57
- package/dist/lib/voice/VoiceConnection.js +0 -150
- package/dist/lib/voice/VoiceConnectionManager.d.ts +0 -19
- package/dist/lib/voice/VoiceConnectionManager.js +0 -66
- package/dist/lib/voice/index.d.ts +0 -2
- package/dist/lib/voice/index.js +0 -18
package/dist/lib/utils/Util.js
DELETED
@@ -1,2228 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.Util = void 0;
|
4
|
-
const constants_1 = require("../constants");
|
5
|
-
class Util {
|
6
|
-
auditLogFromRaw(auditLog) {
|
7
|
-
return {
|
8
|
-
applicationCommands: auditLog.application_commands.map((applicationCommand) => this.applicationCommandFromRaw(applicationCommand)),
|
9
|
-
auditLogEntries: auditLog.audit_log_entries.map((auditLogEntry) => this.auditLogEntryFromRaw(auditLogEntry)),
|
10
|
-
autoModerationRules: auditLog.auto_moderation_rules.map((autoModerationRule) => this.autoModerationRuleFromRaw(autoModerationRule)),
|
11
|
-
guildScheduledEvents: auditLog.guild_scheduled_events.map((guildScheduledEvent) => this.guildScheduledEventFromRaw(guildScheduledEvent)),
|
12
|
-
integrations: auditLog.integrations.map((integration) => this.integrationFromRaw(integration)),
|
13
|
-
threads: auditLog.threads.map((thread) => this.channelFromRaw(thread)),
|
14
|
-
users: auditLog.users.map((user) => this.userFromRaw(user)),
|
15
|
-
webhooks: auditLog.webhooks.map((webhook) => this.webhookFromRaw(webhook)),
|
16
|
-
};
|
17
|
-
}
|
18
|
-
auditLogToRaw(auditLog) {
|
19
|
-
return {
|
20
|
-
application_commands: auditLog.applicationCommands.map((applicationCommand) => this.applicationCommandToRaw(applicationCommand)),
|
21
|
-
audit_log_entries: auditLog.auditLogEntries.map((auditLogEntry) => this.auditLogEntryToRaw(auditLogEntry)),
|
22
|
-
auto_moderation_rules: auditLog.autoModerationRules.map((autoModerationRule) => this.autoModerationRuleToRaw(autoModerationRule)),
|
23
|
-
guild_scheduled_events: auditLog.guildScheduledEvents.map((guildScheduledEvent) => this.guildScheduledEventToRaw(guildScheduledEvent)),
|
24
|
-
integrations: auditLog.integrations.map((integration) => this.integrationToRaw(integration)),
|
25
|
-
threads: auditLog.threads.map((thread) => this.channelToRaw(thread)),
|
26
|
-
users: auditLog.users.map((user) => this.userToRaw(user)),
|
27
|
-
webhooks: auditLog.webhooks.map((webhook) => this.webhookToRaw(webhook)),
|
28
|
-
};
|
29
|
-
}
|
30
|
-
auditLogEntryFromRaw(auditLogEntry) {
|
31
|
-
return {
|
32
|
-
targetID: auditLogEntry.target_id,
|
33
|
-
changes: auditLogEntry.changes?.map((auditLogChange) => ({
|
34
|
-
newValue: auditLogChange.new_value,
|
35
|
-
oldValue: auditLogChange.old_value,
|
36
|
-
key: auditLogChange.key,
|
37
|
-
})),
|
38
|
-
userID: auditLogEntry.user_id,
|
39
|
-
id: auditLogEntry.id,
|
40
|
-
actionType: auditLogEntry.action_type,
|
41
|
-
options: auditLogEntry.options !== undefined
|
42
|
-
? {
|
43
|
-
applicationID: auditLogEntry.options.application_id,
|
44
|
-
autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
|
45
|
-
autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
|
46
|
-
channelID: auditLogEntry.options.channel_id,
|
47
|
-
count: auditLogEntry.options.count,
|
48
|
-
deleteMemberDays: auditLogEntry.options.delete_member_days,
|
49
|
-
id: auditLogEntry.options.id,
|
50
|
-
membersRemoved: auditLogEntry.options.members_removed,
|
51
|
-
messageID: auditLogEntry.options.message_id,
|
52
|
-
roleName: auditLogEntry.options.role_name,
|
53
|
-
type: auditLogEntry.options.type,
|
54
|
-
integrationType: auditLogEntry.options.integration_type,
|
55
|
-
}
|
56
|
-
: undefined,
|
57
|
-
reason: auditLogEntry.reason,
|
58
|
-
};
|
59
|
-
}
|
60
|
-
auditLogEntryToRaw(auditLogEntry) {
|
61
|
-
return {
|
62
|
-
target_id: auditLogEntry.targetID,
|
63
|
-
changes: auditLogEntry.changes?.map((auditLogChange) => ({
|
64
|
-
new_value: auditLogChange.newValue,
|
65
|
-
old_value: auditLogChange.oldValue,
|
66
|
-
key: auditLogChange.key,
|
67
|
-
})),
|
68
|
-
user_id: auditLogEntry.userID,
|
69
|
-
id: auditLogEntry.id,
|
70
|
-
action_type: auditLogEntry.actionType,
|
71
|
-
options: auditLogEntry.options !== undefined
|
72
|
-
? {
|
73
|
-
application_id: auditLogEntry.options.applicationID,
|
74
|
-
auto_moderation_rule_name: auditLogEntry.options.autoModerationRuleName,
|
75
|
-
auto_moderation_rule_trigger_type: auditLogEntry.options.autoModerationRuleTriggerType,
|
76
|
-
channel_id: auditLogEntry.options.channelID,
|
77
|
-
count: auditLogEntry.options.count,
|
78
|
-
delete_member_days: auditLogEntry.options.deleteMemberDays,
|
79
|
-
id: auditLogEntry.options.id,
|
80
|
-
members_removed: auditLogEntry.options.membersRemoved,
|
81
|
-
message_id: auditLogEntry.options.messageID,
|
82
|
-
role_name: auditLogEntry.options.roleName,
|
83
|
-
type: auditLogEntry.options.type,
|
84
|
-
integration_type: auditLogEntry.options.integrationType,
|
85
|
-
}
|
86
|
-
: undefined,
|
87
|
-
reason: auditLogEntry.reason,
|
88
|
-
};
|
89
|
-
}
|
90
|
-
autoModerationRuleFromRaw(autoModerationRule) {
|
91
|
-
return {
|
92
|
-
id: autoModerationRule.id,
|
93
|
-
guildID: autoModerationRule.guild_id,
|
94
|
-
name: autoModerationRule.name,
|
95
|
-
creatorID: autoModerationRule.creator_id,
|
96
|
-
eventType: autoModerationRule.event_type,
|
97
|
-
triggerType: autoModerationRule.trigger_type,
|
98
|
-
triggerMetadata: {
|
99
|
-
keywordFilter: autoModerationRule.trigger_metadata.keyword_filter,
|
100
|
-
regexPatterns: autoModerationRule.trigger_metadata.regex_patterns,
|
101
|
-
presets: autoModerationRule.trigger_metadata.presets,
|
102
|
-
allowList: autoModerationRule.trigger_metadata.allow_list,
|
103
|
-
mentionTotalLimit: autoModerationRule.trigger_metadata.mention_total_limit,
|
104
|
-
mentionRaidProtection: autoModerationRule.trigger_metadata.mention_raid_protection,
|
105
|
-
},
|
106
|
-
actions: autoModerationRule.actions.map((action) => ({
|
107
|
-
type: action.type,
|
108
|
-
metadata: {
|
109
|
-
channelID: action.metadata.channel_id,
|
110
|
-
durationSeconds: action.metadata.duration_seconds,
|
111
|
-
customMessage: action.metadata.custom_message,
|
112
|
-
},
|
113
|
-
})),
|
114
|
-
enabled: autoModerationRule.enabled,
|
115
|
-
exemptRoles: autoModerationRule.exempt_roles,
|
116
|
-
exemptChannels: autoModerationRule.exempt_channels,
|
117
|
-
};
|
118
|
-
}
|
119
|
-
autoModerationRuleToRaw(autoModerationRule) {
|
120
|
-
return {
|
121
|
-
id: autoModerationRule.id,
|
122
|
-
guild_id: autoModerationRule.guildID,
|
123
|
-
name: autoModerationRule.name,
|
124
|
-
creator_id: autoModerationRule.creatorID,
|
125
|
-
event_type: autoModerationRule.eventType,
|
126
|
-
trigger_type: autoModerationRule.triggerType,
|
127
|
-
trigger_metadata: {
|
128
|
-
keyword_filter: autoModerationRule.triggerMetadata.keywordFilter,
|
129
|
-
regex_patterns: autoModerationRule.triggerMetadata.regexPatterns,
|
130
|
-
presets: autoModerationRule.triggerMetadata.presets,
|
131
|
-
allow_list: autoModerationRule.triggerMetadata.allowList,
|
132
|
-
mention_total_limit: autoModerationRule.triggerMetadata.mentionTotalLimit,
|
133
|
-
mention_raid_protection: autoModerationRule.triggerMetadata.mentionRaidProtection,
|
134
|
-
},
|
135
|
-
actions: autoModerationRule.actions.map((action) => ({
|
136
|
-
type: action.type,
|
137
|
-
metadata: {
|
138
|
-
channel_id: action.metadata.channelID,
|
139
|
-
duration_seconds: action.metadata.durationSeconds,
|
140
|
-
custom_message: action.metadata.customMessage,
|
141
|
-
},
|
142
|
-
})),
|
143
|
-
enabled: autoModerationRule.enabled,
|
144
|
-
exempt_roles: autoModerationRule.exemptRoles,
|
145
|
-
exempt_channels: autoModerationRule.exemptChannels,
|
146
|
-
};
|
147
|
-
}
|
148
|
-
attachmentFromRaw(attachment) {
|
149
|
-
return {
|
150
|
-
id: attachment.id,
|
151
|
-
filename: attachment.filename,
|
152
|
-
title: attachment.title,
|
153
|
-
description: attachment.description,
|
154
|
-
contentType: attachment.content_type,
|
155
|
-
size: attachment.size,
|
156
|
-
url: attachment.url,
|
157
|
-
proxyURL: attachment.proxy_url,
|
158
|
-
height: attachment.height,
|
159
|
-
width: attachment.width,
|
160
|
-
ephemeral: attachment.ephemeral,
|
161
|
-
durationSecs: attachment.duration_secs,
|
162
|
-
waveform: attachment.waveform,
|
163
|
-
flags: attachment.flags,
|
164
|
-
};
|
165
|
-
}
|
166
|
-
attachmentToRaw(attachment) {
|
167
|
-
return {
|
168
|
-
id: attachment.id,
|
169
|
-
filename: attachment.filename,
|
170
|
-
title: attachment.title,
|
171
|
-
description: attachment.description,
|
172
|
-
content_type: attachment.contentType,
|
173
|
-
size: attachment.size,
|
174
|
-
url: attachment.url,
|
175
|
-
proxy_url: attachment.proxyURL,
|
176
|
-
height: attachment.height,
|
177
|
-
width: attachment.width,
|
178
|
-
ephemeral: attachment.ephemeral,
|
179
|
-
duration_secs: attachment.durationSecs,
|
180
|
-
waveform: attachment.waveform,
|
181
|
-
flags: attachment.flags,
|
182
|
-
};
|
183
|
-
}
|
184
|
-
applicationFromRaw(application) {
|
185
|
-
return {
|
186
|
-
id: application.id,
|
187
|
-
name: application.name,
|
188
|
-
icon: application.icon,
|
189
|
-
description: application.description,
|
190
|
-
rpcOrigins: application.rpc_origins,
|
191
|
-
botPublic: application.bot_public,
|
192
|
-
botRequireCodeGrant: application.bot_require_code_grant,
|
193
|
-
termsOfServiceURL: application.terms_of_service_url,
|
194
|
-
privacyPolicyURL: application.privacy_policy_url,
|
195
|
-
owner: application.owner !== undefined
|
196
|
-
? this.userFromRaw(application.owner)
|
197
|
-
: undefined,
|
198
|
-
verifyKey: application.verify_key,
|
199
|
-
team: application.team !== null ? this.teamFromRaw(application.team) : null,
|
200
|
-
guildID: application.guild_id,
|
201
|
-
guild: application.guild !== undefined
|
202
|
-
? this.guildFromRaw(application.guild)
|
203
|
-
: undefined,
|
204
|
-
primarySKUID: application.primary_sku_id,
|
205
|
-
slug: application.slug,
|
206
|
-
coverImage: application.cover_image,
|
207
|
-
flags: application.flags,
|
208
|
-
approximateGuildCount: application.approximate_guild_count,
|
209
|
-
redirectURIs: application.redirect_uris,
|
210
|
-
interactionsEndpointURL: application.interactions_endpoint_url,
|
211
|
-
roleConnectionsVerificationURL: application.role_connections_verification_url,
|
212
|
-
tags: application.tags,
|
213
|
-
installParams: application.install_params,
|
214
|
-
integrationTypesConfig: application.integration_types_config !== undefined
|
215
|
-
? {
|
216
|
-
"0": {
|
217
|
-
oauth2InstallParams: application.integration_types_config?.[0]
|
218
|
-
.oauth2_install_params,
|
219
|
-
},
|
220
|
-
"1": {
|
221
|
-
oauth2InstallParams: application.integration_types_config?.[1]
|
222
|
-
.oauth2_install_params,
|
223
|
-
},
|
224
|
-
}
|
225
|
-
: undefined,
|
226
|
-
customInstallURL: application.custom_install_url,
|
227
|
-
};
|
228
|
-
}
|
229
|
-
applicationToRaw(application) {
|
230
|
-
return {
|
231
|
-
id: application.id,
|
232
|
-
name: application.name,
|
233
|
-
icon: application.icon,
|
234
|
-
description: application.description,
|
235
|
-
rpc_origins: application.rpcOrigins,
|
236
|
-
bot_public: application.botPublic,
|
237
|
-
bot_require_code_grant: application.botRequireCodeGrant,
|
238
|
-
terms_of_service_url: application.termsOfServiceURL,
|
239
|
-
privacy_policy_url: application.privacyPolicyURL,
|
240
|
-
owner: application.owner !== undefined
|
241
|
-
? this.userToRaw(application.owner)
|
242
|
-
: undefined,
|
243
|
-
verify_key: application.verifyKey,
|
244
|
-
team: application.team !== null ? this.teamToRaw(application.team) : null,
|
245
|
-
guild_id: application.guildID,
|
246
|
-
guild: application.guild !== undefined
|
247
|
-
? this.guildToRaw(application.guild)
|
248
|
-
: undefined,
|
249
|
-
primary_sku_id: application.primarySKUID,
|
250
|
-
slug: application.slug,
|
251
|
-
cover_image: application.coverImage,
|
252
|
-
flags: application.flags,
|
253
|
-
approximate_guild_count: application.approximateGuildCount,
|
254
|
-
redirect_uris: application.redirectURIs,
|
255
|
-
interactions_endpoint_url: application.interactionsEndpointURL,
|
256
|
-
role_connections_verification_url: application.roleConnectionsVerificationURL,
|
257
|
-
tags: application.tags,
|
258
|
-
install_params: application.installParams,
|
259
|
-
integration_types_config: application.integrationTypesConfig !== undefined
|
260
|
-
? {
|
261
|
-
"0": {
|
262
|
-
oauth2_install_params: application.integrationTypesConfig?.[0].oauth2InstallParams,
|
263
|
-
},
|
264
|
-
"1": {
|
265
|
-
oauth2_install_params: application.integrationTypesConfig?.[1].oauth2InstallParams,
|
266
|
-
},
|
267
|
-
}
|
268
|
-
: undefined,
|
269
|
-
custom_install_url: application.customInstallURL,
|
270
|
-
};
|
271
|
-
}
|
272
|
-
applicationCommandFromRaw(applicationCommand) {
|
273
|
-
return {
|
274
|
-
id: applicationCommand.id,
|
275
|
-
type: applicationCommand.type,
|
276
|
-
applicationID: applicationCommand.application_id,
|
277
|
-
guildID: applicationCommand.guild_id,
|
278
|
-
name: applicationCommand.name,
|
279
|
-
nameLocalizations: applicationCommand.name_localizations,
|
280
|
-
description: applicationCommand.description,
|
281
|
-
descriptionLocalizations: applicationCommand.description_localizations,
|
282
|
-
options: applicationCommand.options?.map((option) => ({
|
283
|
-
type: option.type,
|
284
|
-
name: option.name,
|
285
|
-
name_localizations: option.name_localizations,
|
286
|
-
description: option.description,
|
287
|
-
description_localizations: option.description_localizations,
|
288
|
-
required: option.required,
|
289
|
-
choices: option.choices?.map((choice) => ({
|
290
|
-
name: choice.name,
|
291
|
-
name_localizations: choice.name_localizations,
|
292
|
-
value: choice.value,
|
293
|
-
})),
|
294
|
-
options: option.options?.map((o) => ({
|
295
|
-
type: o.type,
|
296
|
-
name: o.name,
|
297
|
-
name_localizations: o.name_localizations,
|
298
|
-
description: o.description,
|
299
|
-
description_localizations: o.description_localizations,
|
300
|
-
required: o.required,
|
301
|
-
choices: o.choices?.map((choice) => ({
|
302
|
-
name: choice.name,
|
303
|
-
name_localizations: choice.name_localizations,
|
304
|
-
value: choice.value,
|
305
|
-
})),
|
306
|
-
channel_types: o.channel_types,
|
307
|
-
min_value: o.min_value,
|
308
|
-
max_value: o.max_value,
|
309
|
-
min_length: o.min_length,
|
310
|
-
max_length: o.max_length,
|
311
|
-
autocomplete: o.autocomplete,
|
312
|
-
})),
|
313
|
-
channel_types: option.channel_types,
|
314
|
-
min_value: option.min_value,
|
315
|
-
max_value: option.max_value,
|
316
|
-
min_length: option.min_length,
|
317
|
-
max_length: option.max_length,
|
318
|
-
autocomplete: option.autocomplete,
|
319
|
-
})),
|
320
|
-
defaultMemberPermissions: applicationCommand.default_member_permissions,
|
321
|
-
dmPermission: applicationCommand.dm_permission,
|
322
|
-
defaultPermission: applicationCommand.default_permission,
|
323
|
-
nsfw: applicationCommand.nsfw,
|
324
|
-
version: applicationCommand.version,
|
325
|
-
};
|
326
|
-
}
|
327
|
-
applicationCommandToRaw(applicationCommand) {
|
328
|
-
return {
|
329
|
-
id: applicationCommand.id,
|
330
|
-
type: applicationCommand.type,
|
331
|
-
application_id: applicationCommand.applicationID,
|
332
|
-
guild_id: applicationCommand.guildID,
|
333
|
-
name: applicationCommand.name,
|
334
|
-
name_localizations: applicationCommand.nameLocalizations,
|
335
|
-
description: applicationCommand.description,
|
336
|
-
description_localizations: applicationCommand.descriptionLocalizations,
|
337
|
-
options: applicationCommand.options?.map((option) => ({
|
338
|
-
type: option.type,
|
339
|
-
name: option.name,
|
340
|
-
name_localizations: option.nameLocalizations,
|
341
|
-
description: option.description,
|
342
|
-
description_localizations: option.descriptionLocalizations,
|
343
|
-
required: option.required,
|
344
|
-
choices: option.choices?.map((choice) => ({
|
345
|
-
name: choice.name,
|
346
|
-
name_localizations: choice.nameLocalizations,
|
347
|
-
value: choice.value,
|
348
|
-
})),
|
349
|
-
options: option.options?.map((o) => ({
|
350
|
-
type: o.type,
|
351
|
-
name: o.name,
|
352
|
-
name_localizations: o.nameLocalizations,
|
353
|
-
description: o.description,
|
354
|
-
description_localizations: o.descriptionLocalizations,
|
355
|
-
required: o.required,
|
356
|
-
choices: o.choices?.map((choice) => ({
|
357
|
-
name: choice.name,
|
358
|
-
name_localizations: choice.nameLocalizations,
|
359
|
-
value: choice.value,
|
360
|
-
})),
|
361
|
-
channel_types: o.channelTypes,
|
362
|
-
min_value: o.minValue,
|
363
|
-
max_value: o.maxValue,
|
364
|
-
min_length: o.minLength,
|
365
|
-
max_length: o.maxLength,
|
366
|
-
autocomplete: o.autocomplete,
|
367
|
-
})),
|
368
|
-
channel_types: option.channelTypes,
|
369
|
-
min_value: option.minValue,
|
370
|
-
max_value: option.maxValue,
|
371
|
-
min_length: option.minLength,
|
372
|
-
max_length: option.maxLength,
|
373
|
-
autocomplete: option.autocomplete,
|
374
|
-
})),
|
375
|
-
default_member_permissions: applicationCommand.defaultMemberPermissions,
|
376
|
-
dm_permission: applicationCommand.dmPermission,
|
377
|
-
default_permission: applicationCommand.defaultPermission,
|
378
|
-
nsfw: applicationCommand.nsfw,
|
379
|
-
version: applicationCommand.version,
|
380
|
-
};
|
381
|
-
}
|
382
|
-
channelFromRaw(channel) {
|
383
|
-
return {
|
384
|
-
id: channel.id,
|
385
|
-
type: channel.type,
|
386
|
-
guildID: channel.guild_id,
|
387
|
-
position: channel.position,
|
388
|
-
permissionOverwrites: channel.permission_overwrites?.map((overwrite) => ({
|
389
|
-
id: overwrite.id,
|
390
|
-
type: overwrite.type,
|
391
|
-
allow: overwrite.allow,
|
392
|
-
deny: overwrite.deny,
|
393
|
-
})),
|
394
|
-
name: channel.name,
|
395
|
-
topic: channel.topic,
|
396
|
-
nsfw: channel.nsfw,
|
397
|
-
lastMessageID: channel.last_message_id,
|
398
|
-
bitrate: channel.bitrate,
|
399
|
-
userLimit: channel.user_limit,
|
400
|
-
rateLimitPerUser: channel.rate_limit_per_user,
|
401
|
-
recipients: channel.recipients?.map((recipient) => this.userFromRaw(recipient)),
|
402
|
-
icon: channel.icon,
|
403
|
-
ownerID: channel.owner_id,
|
404
|
-
applicationID: channel.application_id,
|
405
|
-
managed: channel.managed,
|
406
|
-
parentID: channel.parent_id,
|
407
|
-
lastPinTimestamp: channel.last_pin_timestamp,
|
408
|
-
rtcRegion: channel.rtc_region,
|
409
|
-
videoQualityMode: channel.video_quality_mode,
|
410
|
-
messageCount: channel.member_count,
|
411
|
-
memberCount: channel.member_count,
|
412
|
-
threadMetadata: channel.thread_metadata !== undefined
|
413
|
-
? {
|
414
|
-
archived: channel.thread_metadata?.archived,
|
415
|
-
autoArchiveDuration: channel.thread_metadata?.auto_archive_duration,
|
416
|
-
archiveTimestamp: channel.thread_metadata?.archive_timestamp,
|
417
|
-
locked: channel.thread_metadata?.locked,
|
418
|
-
invitable: channel.thread_metadata?.invitable,
|
419
|
-
createTimestamp: channel.thread_metadata?.create_timestamp,
|
420
|
-
}
|
421
|
-
: undefined,
|
422
|
-
member: channel.member !== undefined
|
423
|
-
? {
|
424
|
-
id: channel.member.id,
|
425
|
-
userID: channel.member.user_id,
|
426
|
-
joinTimestamp: channel.member.join_timestamp,
|
427
|
-
flags: channel.member.flags,
|
428
|
-
member: channel.member.member !== undefined
|
429
|
-
? {
|
430
|
-
user: channel.member.member.user !== undefined
|
431
|
-
? this.userFromRaw(channel.member.member.user)
|
432
|
-
: undefined,
|
433
|
-
nick: channel.member.member.nick,
|
434
|
-
avatar: channel.member.member.avatar,
|
435
|
-
roles: channel.member.member.roles,
|
436
|
-
joinedAt: channel.member.member.joined_at,
|
437
|
-
premiumSince: channel.member.member.premium_since,
|
438
|
-
deaf: channel.member.member.deaf,
|
439
|
-
mute: channel.member.member.mute,
|
440
|
-
flags: channel.member.member.flags,
|
441
|
-
pending: channel.member.member.pending,
|
442
|
-
permissions: channel.member.member.permissions,
|
443
|
-
communicationDisabledUntil: channel.member.member.communication_disabled_until,
|
444
|
-
}
|
445
|
-
: undefined,
|
446
|
-
}
|
447
|
-
: undefined,
|
448
|
-
defaultAutoArchiveDuration: channel.default_auto_archive_duration,
|
449
|
-
permissions: channel.permissions,
|
450
|
-
flags: channel.flags,
|
451
|
-
totalMessageSent: channel.total_message_sent,
|
452
|
-
availableTags: channel.available_tags?.map((availableTag) => ({
|
453
|
-
id: availableTag.id,
|
454
|
-
name: availableTag.name,
|
455
|
-
moderated: availableTag.moderated,
|
456
|
-
emojiID: availableTag.emoji_id,
|
457
|
-
emojiName: availableTag.emoji_name,
|
458
|
-
})),
|
459
|
-
appliedTags: channel.applied_tags,
|
460
|
-
defaultReactionEmoji: channel.default_reaction_emoji !== undefined
|
461
|
-
? channel.default_reaction_emoji !== null
|
462
|
-
? {
|
463
|
-
emojiID: channel.default_reaction_emoji.emoji_id,
|
464
|
-
emojiName: channel.default_reaction_emoji.emoji_name,
|
465
|
-
}
|
466
|
-
: null
|
467
|
-
: undefined,
|
468
|
-
defaultThreadRateLimitPerUser: channel.default_thread_rate_limit_per_user,
|
469
|
-
defaultSortOrder: channel.default_sort_order,
|
470
|
-
defaultForumLayout: channel.default_forum_layout,
|
471
|
-
};
|
472
|
-
}
|
473
|
-
channelToRaw(channel) {
|
474
|
-
return {
|
475
|
-
id: channel.id,
|
476
|
-
type: channel.type,
|
477
|
-
guild_id: channel.guildID,
|
478
|
-
position: channel.position,
|
479
|
-
permission_overwrites: channel.permissionOverwrites?.map((overwrite) => ({
|
480
|
-
id: overwrite.id,
|
481
|
-
type: overwrite.type,
|
482
|
-
allow: overwrite.allow,
|
483
|
-
deny: overwrite.deny,
|
484
|
-
})),
|
485
|
-
name: channel.name,
|
486
|
-
topic: channel.topic,
|
487
|
-
nsfw: channel.nsfw,
|
488
|
-
last_message_id: channel.lastMessageID,
|
489
|
-
bitrate: channel.bitrate,
|
490
|
-
user_limit: channel.userLimit,
|
491
|
-
rate_limit_per_user: channel.rateLimitPerUser,
|
492
|
-
recipients: channel.recipients?.map((recipient) => this.userToRaw(recipient)),
|
493
|
-
icon: channel.icon,
|
494
|
-
owner_id: channel.ownerID,
|
495
|
-
application_id: channel.applicationID,
|
496
|
-
managed: channel.managed,
|
497
|
-
parent_id: channel.parentID,
|
498
|
-
last_pin_timestamp: channel.lastPinTimestamp,
|
499
|
-
rtc_region: channel.rtcRegion,
|
500
|
-
video_quality_mode: channel.videoQualityMode,
|
501
|
-
message_count: channel.messageCount,
|
502
|
-
member_count: channel.memberCount,
|
503
|
-
thread_metadata: channel.threadMetadata !== undefined
|
504
|
-
? {
|
505
|
-
archived: channel.threadMetadata?.archived,
|
506
|
-
auto_archive_duration: channel.threadMetadata?.autoArchiveDuration,
|
507
|
-
archive_timestamp: channel.threadMetadata?.archiveTimestamp,
|
508
|
-
locked: channel.threadMetadata?.locked,
|
509
|
-
invitable: channel.threadMetadata?.invitable,
|
510
|
-
create_timestamp: channel.threadMetadata?.createTimestamp,
|
511
|
-
}
|
512
|
-
: undefined,
|
513
|
-
member: channel.member !== undefined
|
514
|
-
? {
|
515
|
-
id: channel.member.id,
|
516
|
-
user_id: channel.member.userID,
|
517
|
-
join_timestamp: channel.member.joinTimestamp,
|
518
|
-
flags: channel.member.flags,
|
519
|
-
member: channel.member.member !== undefined
|
520
|
-
? {
|
521
|
-
user: channel.member.member.user !== undefined
|
522
|
-
? this.userToRaw(channel.member.member.user)
|
523
|
-
: undefined,
|
524
|
-
nick: channel.member.member.nick,
|
525
|
-
avatar: channel.member.member.avatar,
|
526
|
-
roles: channel.member.member.roles,
|
527
|
-
joined_at: channel.member.member.joinedAt,
|
528
|
-
premium_since: channel.member.member.premiumSince,
|
529
|
-
deaf: channel.member.member.deaf,
|
530
|
-
mute: channel.member.member.mute,
|
531
|
-
flags: channel.member.member.flags,
|
532
|
-
pending: channel.member.member.pending,
|
533
|
-
permissions: channel.member.member.permissions,
|
534
|
-
communication_disabled_until: channel.member.member.communicationDisabledUntil,
|
535
|
-
}
|
536
|
-
: undefined,
|
537
|
-
}
|
538
|
-
: undefined,
|
539
|
-
default_auto_archive_duration: channel.defaultAutoArchiveDuration,
|
540
|
-
permissions: channel.permissions,
|
541
|
-
flags: channel.flags,
|
542
|
-
total_message_sent: channel.totalMessageSent,
|
543
|
-
available_tags: channel.availableTags?.map((availableTag) => ({
|
544
|
-
id: availableTag.id,
|
545
|
-
name: availableTag.name,
|
546
|
-
moderated: availableTag.moderated,
|
547
|
-
emoji_id: availableTag.emojiID,
|
548
|
-
emoji_name: availableTag.emojiName,
|
549
|
-
})),
|
550
|
-
applied_tags: channel.appliedTags,
|
551
|
-
default_reaction_emoji: channel.defaultReactionEmoji !== undefined
|
552
|
-
? channel.defaultReactionEmoji !== null
|
553
|
-
? {
|
554
|
-
emoji_id: channel.defaultReactionEmoji.emojiID,
|
555
|
-
emoji_name: channel.defaultReactionEmoji.emojiName,
|
556
|
-
}
|
557
|
-
: null
|
558
|
-
: undefined,
|
559
|
-
default_thread_rate_limit_per_user: channel.defaultThreadRateLimitPerUser,
|
560
|
-
default_sort_order: channel.defaultSortOrder,
|
561
|
-
default_forum_layout: channel.defaultForumLayout,
|
562
|
-
};
|
563
|
-
}
|
564
|
-
embedFromRaw(embed) {
|
565
|
-
return {
|
566
|
-
title: embed.title,
|
567
|
-
type: embed.type,
|
568
|
-
description: embed.description,
|
569
|
-
url: embed.url,
|
570
|
-
timestamp: embed.timestamp,
|
571
|
-
color: embed.color,
|
572
|
-
footer: embed.footer !== undefined
|
573
|
-
? {
|
574
|
-
text: embed.footer.text,
|
575
|
-
iconURL: embed.footer.icon_url,
|
576
|
-
proxyIconURL: embed.footer.proxy_icon_url,
|
577
|
-
}
|
578
|
-
: undefined,
|
579
|
-
image: embed.image !== undefined
|
580
|
-
? {
|
581
|
-
url: embed.image.url,
|
582
|
-
proxyURL: embed.image.proxy_url,
|
583
|
-
height: embed.image.height,
|
584
|
-
width: embed.image.width,
|
585
|
-
}
|
586
|
-
: undefined,
|
587
|
-
thumbnail: embed.thumbnail !== undefined
|
588
|
-
? {
|
589
|
-
url: embed.thumbnail.url,
|
590
|
-
proxyURL: embed.thumbnail.proxy_url,
|
591
|
-
height: embed.thumbnail.height,
|
592
|
-
width: embed.thumbnail.width,
|
593
|
-
}
|
594
|
-
: undefined,
|
595
|
-
video: {
|
596
|
-
url: embed.video?.url,
|
597
|
-
proxyURL: embed.video?.proxy_url,
|
598
|
-
height: embed.video?.height,
|
599
|
-
width: embed.video?.width,
|
600
|
-
},
|
601
|
-
provider: {
|
602
|
-
name: embed.provider?.name,
|
603
|
-
url: embed.provider?.url,
|
604
|
-
},
|
605
|
-
author: embed.author !== undefined
|
606
|
-
? {
|
607
|
-
name: embed.author.name,
|
608
|
-
url: embed.author.url,
|
609
|
-
iconURL: embed.author.icon_url,
|
610
|
-
proxyIconURL: embed.author.proxy_icon_url,
|
611
|
-
}
|
612
|
-
: undefined,
|
613
|
-
fields: embed.fields?.map((field) => ({
|
614
|
-
name: field.name,
|
615
|
-
value: field.value,
|
616
|
-
inline: field.inline,
|
617
|
-
})),
|
618
|
-
};
|
619
|
-
}
|
620
|
-
embedToRaw(embed) {
|
621
|
-
return {
|
622
|
-
title: embed.title,
|
623
|
-
type: embed.type,
|
624
|
-
description: embed.description,
|
625
|
-
url: embed.url,
|
626
|
-
timestamp: embed.timestamp,
|
627
|
-
color: embed.color,
|
628
|
-
footer: embed.footer !== undefined
|
629
|
-
? {
|
630
|
-
text: embed.footer.text,
|
631
|
-
icon_url: embed.footer.iconURL,
|
632
|
-
proxy_icon_url: embed.footer.proxyIconURL,
|
633
|
-
}
|
634
|
-
: undefined,
|
635
|
-
image: embed.image !== undefined
|
636
|
-
? {
|
637
|
-
url: embed.image.url,
|
638
|
-
proxy_url: embed.image.proxyURL,
|
639
|
-
height: embed.image.height,
|
640
|
-
width: embed.image.width,
|
641
|
-
}
|
642
|
-
: undefined,
|
643
|
-
thumbnail: embed.thumbnail !== undefined
|
644
|
-
? {
|
645
|
-
url: embed.thumbnail.url,
|
646
|
-
proxy_url: embed.thumbnail.proxyURL,
|
647
|
-
height: embed.thumbnail.height,
|
648
|
-
width: embed.thumbnail.width,
|
649
|
-
}
|
650
|
-
: undefined,
|
651
|
-
video: {
|
652
|
-
url: embed.video?.url,
|
653
|
-
proxy_url: embed.video?.proxyURL,
|
654
|
-
height: embed.video?.height,
|
655
|
-
width: embed.video?.width,
|
656
|
-
},
|
657
|
-
provider: {
|
658
|
-
name: embed.provider?.name,
|
659
|
-
url: embed.provider?.url,
|
660
|
-
},
|
661
|
-
author: embed.author !== undefined
|
662
|
-
? {
|
663
|
-
name: embed.author.name,
|
664
|
-
url: embed.author.url,
|
665
|
-
icon_url: embed.author.iconURL,
|
666
|
-
proxy_icon_url: embed.author.proxyIconURL,
|
667
|
-
}
|
668
|
-
: undefined,
|
669
|
-
fields: embed.fields?.map((field) => ({
|
670
|
-
name: field.name,
|
671
|
-
value: field.value,
|
672
|
-
inline: field.inline,
|
673
|
-
})),
|
674
|
-
};
|
675
|
-
}
|
676
|
-
emojiFromRaw(emoji) {
|
677
|
-
return {
|
678
|
-
id: emoji.id,
|
679
|
-
name: emoji.name,
|
680
|
-
roles: emoji.roles,
|
681
|
-
user: emoji.user !== undefined ? this.userFromRaw(emoji.user) : undefined,
|
682
|
-
requireColons: emoji.require_colons,
|
683
|
-
managed: emoji.managed,
|
684
|
-
animated: emoji.animated,
|
685
|
-
available: emoji.available,
|
686
|
-
};
|
687
|
-
}
|
688
|
-
emojiToRaw(emoji) {
|
689
|
-
return {
|
690
|
-
id: emoji.id,
|
691
|
-
name: emoji.name,
|
692
|
-
roles: emoji.roles,
|
693
|
-
user: emoji.user !== undefined ? this.userToRaw(emoji.user) : undefined,
|
694
|
-
require_colons: emoji.requireColons,
|
695
|
-
managed: emoji.managed,
|
696
|
-
animated: emoji.animated,
|
697
|
-
available: emoji.available,
|
698
|
-
};
|
699
|
-
}
|
700
|
-
entitlementFromRaw(entitlement) {
|
701
|
-
return {
|
702
|
-
id: entitlement.id,
|
703
|
-
skuID: entitlement.sku_id,
|
704
|
-
applicationID: entitlement.application_id,
|
705
|
-
userID: entitlement.user_id,
|
706
|
-
promotionID: entitlement.promotion_id,
|
707
|
-
type: entitlement.type,
|
708
|
-
deleted: entitlement.deleted,
|
709
|
-
giftCodeFlags: entitlement.gift_code_flags,
|
710
|
-
consumed: entitlement.consumed,
|
711
|
-
startsAt: entitlement.starts_at,
|
712
|
-
endsAt: entitlement.ends_at,
|
713
|
-
guildID: entitlement.guild_id,
|
714
|
-
subscriptionID: entitlement.subscription_id,
|
715
|
-
};
|
716
|
-
}
|
717
|
-
entitlementToRaw(entitlement) {
|
718
|
-
return {
|
719
|
-
id: entitlement.id,
|
720
|
-
sku_id: entitlement.skuID,
|
721
|
-
application_id: entitlement.applicationID,
|
722
|
-
user_id: entitlement.userID,
|
723
|
-
promotion_id: entitlement.promotionID,
|
724
|
-
type: entitlement.type,
|
725
|
-
deleted: entitlement.deleted,
|
726
|
-
gift_code_flags: entitlement.giftCodeFlags,
|
727
|
-
consumed: entitlement.consumed,
|
728
|
-
starts_at: entitlement.startsAt,
|
729
|
-
ends_at: entitlement.endsAt,
|
730
|
-
guild_id: entitlement.guildID,
|
731
|
-
subscription_id: entitlement.subscriptionID,
|
732
|
-
};
|
733
|
-
}
|
734
|
-
guildApplicationCommandPermissionsFromRaw(guildApplicationCommandPermissions) {
|
735
|
-
return {
|
736
|
-
id: guildApplicationCommandPermissions.id,
|
737
|
-
applicationID: guildApplicationCommandPermissions.application_id,
|
738
|
-
guildID: guildApplicationCommandPermissions.guild_id,
|
739
|
-
permissions: guildApplicationCommandPermissions.permissions.map((permission) => ({
|
740
|
-
id: permission.id,
|
741
|
-
type: permission.type,
|
742
|
-
permission: permission.permission,
|
743
|
-
})),
|
744
|
-
};
|
745
|
-
}
|
746
|
-
guildApplicationCommandPermissionsToRaw(guildApplicationCommandPermissions) {
|
747
|
-
return {
|
748
|
-
id: guildApplicationCommandPermissions.id,
|
749
|
-
application_id: guildApplicationCommandPermissions.applicationID,
|
750
|
-
guild_id: guildApplicationCommandPermissions.guildID,
|
751
|
-
permissions: guildApplicationCommandPermissions.permissions.map((permission) => ({
|
752
|
-
id: permission.id,
|
753
|
-
type: permission.type,
|
754
|
-
permission: permission.permission,
|
755
|
-
})),
|
756
|
-
};
|
757
|
-
}
|
758
|
-
guildFromRaw(guild) {
|
759
|
-
return {
|
760
|
-
id: guild.id,
|
761
|
-
name: guild.name,
|
762
|
-
icon: guild.icon,
|
763
|
-
iconHash: guild.icon,
|
764
|
-
splash: guild.splash,
|
765
|
-
discoverySplash: guild.discovery_splash,
|
766
|
-
owner: guild.owner,
|
767
|
-
ownerID: guild.owner_id,
|
768
|
-
permissions: guild.permissions,
|
769
|
-
region: guild.region,
|
770
|
-
afkChannelID: guild.afk_channel_id,
|
771
|
-
afkTimeout: guild.afk_timeout,
|
772
|
-
widgetEnabled: guild.widget_enabled,
|
773
|
-
widgetChannelID: guild.widget_channel_id,
|
774
|
-
verificationLevel: guild.verification_level,
|
775
|
-
defaultMessageNotifications: guild.default_message_notifications,
|
776
|
-
explicitContentFilter: guild.explicit_content_filter,
|
777
|
-
roles: guild.roles.map((role) => this.roleFromRaw(role)),
|
778
|
-
emojis: guild.emojis.map((emoji) => this.emojiFromRaw(emoji)),
|
779
|
-
features: guild.features,
|
780
|
-
mfaLevel: guild.mfa_level,
|
781
|
-
applicationID: guild.application_id,
|
782
|
-
systemChannelID: guild.system_channel_id,
|
783
|
-
systemChannelFlags: guild.system_channel_flags,
|
784
|
-
rulesChannelID: guild.rules_channel_id,
|
785
|
-
maxPresences: guild.max_presences,
|
786
|
-
maxMembers: guild.max_members,
|
787
|
-
vanityURLCode: guild.vanity_url_code,
|
788
|
-
description: guild.description,
|
789
|
-
banner: guild.banner,
|
790
|
-
premiumTier: guild.premium_tier,
|
791
|
-
premiumSubscriptionCount: guild.premium_subscription_count,
|
792
|
-
preferredLocale: guild.preferred_locale,
|
793
|
-
publicUpdatesChannelID: guild.public_updates_channel_id,
|
794
|
-
maxVideoChannelUsers: guild.max_video_channel_users,
|
795
|
-
maxStageVideoChannelUsers: guild.max_stage_video_channel_users,
|
796
|
-
approximateMemberCount: guild.approximate_member_count,
|
797
|
-
approximatePresenceCount: guild.approximate_presence_count,
|
798
|
-
welcomeScreen: guild.welcome_screen !== undefined
|
799
|
-
? {
|
800
|
-
description: guild.welcome_screen.description,
|
801
|
-
welcomeChannels: guild.welcome_screen.welcome_channels.map((welcomeScreenChannel) => ({
|
802
|
-
channelID: welcomeScreenChannel.channel_id,
|
803
|
-
description: welcomeScreenChannel.description,
|
804
|
-
emojiID: welcomeScreenChannel.emoji_id,
|
805
|
-
emojiName: welcomeScreenChannel.emoji_name,
|
806
|
-
})),
|
807
|
-
}
|
808
|
-
: undefined,
|
809
|
-
nsfwLevel: guild.nsfw_level,
|
810
|
-
stickers: guild.stickers?.map((sticker) => this.stickerFromRaw(sticker)),
|
811
|
-
premiumProgressBarEnabled: guild.premium_progress_bar_enabled,
|
812
|
-
safetyAlertsChannelID: guild.safety_alerts_channel_id,
|
813
|
-
};
|
814
|
-
}
|
815
|
-
guildToRaw(guild) {
|
816
|
-
return {
|
817
|
-
id: guild.id,
|
818
|
-
name: guild.name,
|
819
|
-
icon: guild.icon,
|
820
|
-
icon_hash: guild.icon,
|
821
|
-
splash: guild.splash,
|
822
|
-
discovery_splash: guild.discoverySplash,
|
823
|
-
owner: guild.owner,
|
824
|
-
owner_id: guild.ownerID,
|
825
|
-
permissions: guild.permissions,
|
826
|
-
region: guild.region,
|
827
|
-
afk_channel_id: guild.afkChannelID,
|
828
|
-
afk_timeout: guild.afkTimeout,
|
829
|
-
widget_enabled: guild.widgetEnabled,
|
830
|
-
widget_channel_id: guild.widgetChannelID,
|
831
|
-
verification_level: guild.verificationLevel,
|
832
|
-
default_message_notifications: guild.defaultMessageNotifications,
|
833
|
-
explicit_content_filter: guild.explicitContentFilter,
|
834
|
-
roles: guild.roles.map((role) => this.roleToRaw(role)),
|
835
|
-
emojis: guild.emojis.map((emoji) => this.emojiToRaw(emoji)),
|
836
|
-
features: guild.features,
|
837
|
-
mfa_level: guild.mfaLevel,
|
838
|
-
application_id: guild.applicationID,
|
839
|
-
system_channel_id: guild.systemChannelID,
|
840
|
-
system_channel_flags: guild.systemChannelFlags,
|
841
|
-
rules_channel_id: guild.rulesChannelID,
|
842
|
-
max_presences: guild.maxPresences,
|
843
|
-
max_members: guild.maxMembers,
|
844
|
-
vanity_url_code: guild.vanityURLCode,
|
845
|
-
description: guild.description,
|
846
|
-
banner: guild.banner,
|
847
|
-
premium_tier: guild.premiumTier,
|
848
|
-
premium_subscription_count: guild.premiumSubscriptionCount,
|
849
|
-
preferred_locale: guild.preferredLocale,
|
850
|
-
public_updates_channel_id: guild.publicUpdatesChannelID,
|
851
|
-
max_video_channel_users: guild.maxVideoChannelUsers,
|
852
|
-
max_stage_video_channel_users: guild.maxStageVideoChannelUsers,
|
853
|
-
approximate_member_count: guild.approximateMemberCount,
|
854
|
-
approximate_presence_count: guild.approximatePresenceCount,
|
855
|
-
welcome_screen: guild.welcomeScreen !== undefined
|
856
|
-
? {
|
857
|
-
description: guild.welcomeScreen.description,
|
858
|
-
welcome_channels: guild.welcomeScreen.welcomeChannels.map((welcomeScreenChannel) => ({
|
859
|
-
channel_id: welcomeScreenChannel.channelID,
|
860
|
-
description: welcomeScreenChannel.description,
|
861
|
-
emoji_id: welcomeScreenChannel.emojiID,
|
862
|
-
emoji_name: welcomeScreenChannel.emojiName,
|
863
|
-
})),
|
864
|
-
}
|
865
|
-
: undefined,
|
866
|
-
nsfw_level: guild.nsfwLevel,
|
867
|
-
stickers: guild.stickers?.map((sticker) => this.stickerToRaw(sticker)),
|
868
|
-
premium_progress_bar_enabled: guild.premiumProgressBarEnabled,
|
869
|
-
safety_alerts_channel_id: guild.safetyAlertsChannelID,
|
870
|
-
};
|
871
|
-
}
|
872
|
-
guildMemberFromRaw(guildMember) {
|
873
|
-
return {
|
874
|
-
user: guildMember.user !== undefined
|
875
|
-
? this.userFromRaw(guildMember.user)
|
876
|
-
: undefined,
|
877
|
-
nick: guildMember.nick,
|
878
|
-
avatar: guildMember.avatar,
|
879
|
-
roles: guildMember.roles,
|
880
|
-
joinedAt: guildMember.joined_at,
|
881
|
-
premiumSince: guildMember.premium_since,
|
882
|
-
deaf: guildMember.deaf,
|
883
|
-
mute: guildMember.mute,
|
884
|
-
flags: guildMember.flags,
|
885
|
-
pending: guildMember.pending,
|
886
|
-
permissions: guildMember.permissions,
|
887
|
-
communicationDisabledUntil: guildMember.communication_disabled_until,
|
888
|
-
};
|
889
|
-
}
|
890
|
-
guildMemberToRaw(guildMember) {
|
891
|
-
return {
|
892
|
-
user: guildMember.user !== undefined
|
893
|
-
? this.userToRaw(guildMember.user)
|
894
|
-
: undefined,
|
895
|
-
nick: guildMember.nick,
|
896
|
-
avatar: guildMember.avatar,
|
897
|
-
roles: guildMember.roles,
|
898
|
-
joined_at: guildMember.joinedAt,
|
899
|
-
premium_since: guildMember.premiumSince,
|
900
|
-
deaf: guildMember.deaf,
|
901
|
-
mute: guildMember.mute,
|
902
|
-
flags: guildMember.flags,
|
903
|
-
pending: guildMember.pending,
|
904
|
-
permissions: guildMember.permissions,
|
905
|
-
communication_disabled_until: guildMember.communicationDisabledUntil,
|
906
|
-
};
|
907
|
-
}
|
908
|
-
guildScheduledEventFromRaw(guildScheduledEvent) {
|
909
|
-
return {
|
910
|
-
id: guildScheduledEvent.id,
|
911
|
-
guildID: guildScheduledEvent.guild_id,
|
912
|
-
channelID: guildScheduledEvent.channel_id,
|
913
|
-
creatorID: guildScheduledEvent.creator_id,
|
914
|
-
name: guildScheduledEvent.name,
|
915
|
-
description: guildScheduledEvent.description,
|
916
|
-
scheduledStartTime: guildScheduledEvent.scheduled_start_time,
|
917
|
-
scheduledEndTime: guildScheduledEvent.scheduled_end_time,
|
918
|
-
privacyLevel: guildScheduledEvent.privacy_level,
|
919
|
-
status: guildScheduledEvent.status,
|
920
|
-
entityType: guildScheduledEvent.entity_type,
|
921
|
-
entityID: guildScheduledEvent.entity_id,
|
922
|
-
entityMetadata: guildScheduledEvent.entity_metadata,
|
923
|
-
creator: guildScheduledEvent.creator !== undefined
|
924
|
-
? this.userFromRaw(guildScheduledEvent.creator)
|
925
|
-
: undefined,
|
926
|
-
userCount: guildScheduledEvent.user_count,
|
927
|
-
image: guildScheduledEvent.image,
|
928
|
-
};
|
929
|
-
}
|
930
|
-
guildScheduledEventToRaw(guildScheduledEvent) {
|
931
|
-
return {
|
932
|
-
id: guildScheduledEvent.id,
|
933
|
-
guild_id: guildScheduledEvent.guildID,
|
934
|
-
channel_id: guildScheduledEvent.channelID,
|
935
|
-
creator_id: guildScheduledEvent.creatorID,
|
936
|
-
name: guildScheduledEvent.name,
|
937
|
-
description: guildScheduledEvent.description,
|
938
|
-
scheduled_start_time: guildScheduledEvent.scheduledStartTime,
|
939
|
-
scheduled_end_time: guildScheduledEvent.scheduledEndTime,
|
940
|
-
privacy_level: guildScheduledEvent.privacyLevel,
|
941
|
-
status: guildScheduledEvent.status,
|
942
|
-
entity_type: guildScheduledEvent.entityType,
|
943
|
-
entity_id: guildScheduledEvent.entityID,
|
944
|
-
entity_metadata: guildScheduledEvent.entityMetadata,
|
945
|
-
creator: guildScheduledEvent.creator !== undefined
|
946
|
-
? this.userToRaw(guildScheduledEvent.creator)
|
947
|
-
: undefined,
|
948
|
-
user_count: guildScheduledEvent.userCount,
|
949
|
-
image: guildScheduledEvent.image,
|
950
|
-
};
|
951
|
-
}
|
952
|
-
guildTemplateFromRaw(guildTemplate) {
|
953
|
-
return {
|
954
|
-
code: guildTemplate.code,
|
955
|
-
name: guildTemplate.name,
|
956
|
-
description: guildTemplate.description,
|
957
|
-
usageCount: guildTemplate.usage_count,
|
958
|
-
creatorID: guildTemplate.creator_id,
|
959
|
-
creator: this.userFromRaw(guildTemplate.creator),
|
960
|
-
createdAt: guildTemplate.created_at,
|
961
|
-
updatedAt: guildTemplate.updated_at,
|
962
|
-
sourceGuildID: guildTemplate.source_guild_id,
|
963
|
-
serializedSourceGuild: this.guildFromRaw(guildTemplate.serialized_source_guild),
|
964
|
-
isDirty: guildTemplate.is_dirty,
|
965
|
-
};
|
966
|
-
}
|
967
|
-
guildTemplateToRaw(guildTemplate) {
|
968
|
-
return {
|
969
|
-
code: guildTemplate.code,
|
970
|
-
name: guildTemplate.name,
|
971
|
-
description: guildTemplate.description,
|
972
|
-
usage_count: guildTemplate.usageCount,
|
973
|
-
creator_id: guildTemplate.creatorID,
|
974
|
-
creator: this.userToRaw(guildTemplate.creator),
|
975
|
-
created_at: guildTemplate.createdAt,
|
976
|
-
updated_at: guildTemplate.updatedAt,
|
977
|
-
source_guild_id: guildTemplate.sourceGuildID,
|
978
|
-
serialized_source_guild: this.guildToRaw(guildTemplate.serializedSourceGuild),
|
979
|
-
is_dirty: guildTemplate.isDirty,
|
980
|
-
};
|
981
|
-
}
|
982
|
-
integrationFromRaw(integration) {
|
983
|
-
return {
|
984
|
-
id: integration.id,
|
985
|
-
name: integration.name,
|
986
|
-
type: integration.type,
|
987
|
-
enabled: integration.enabled,
|
988
|
-
syncing: integration.syncing,
|
989
|
-
roleID: integration.role_id,
|
990
|
-
enableEmoticons: integration.enable_emoticons,
|
991
|
-
expireBehavior: integration.expire_behavior,
|
992
|
-
expireGracePeriod: integration.expire_grace_period,
|
993
|
-
user: integration.user !== undefined
|
994
|
-
? this.userFromRaw(integration.user)
|
995
|
-
: undefined,
|
996
|
-
account: integration.account,
|
997
|
-
syncedAt: integration.synced_at,
|
998
|
-
subscriberCount: integration.subscriber_count,
|
999
|
-
revoked: integration.revoked,
|
1000
|
-
application: integration.application !== undefined
|
1001
|
-
? {
|
1002
|
-
id: integration.application.id,
|
1003
|
-
name: integration.application.name,
|
1004
|
-
icon: integration.application.icon,
|
1005
|
-
description: integration.application.description,
|
1006
|
-
bot: integration.application.bot !== undefined
|
1007
|
-
? this.userFromRaw(integration.application.bot)
|
1008
|
-
: undefined,
|
1009
|
-
}
|
1010
|
-
: undefined,
|
1011
|
-
scopes: integration.scopes,
|
1012
|
-
};
|
1013
|
-
}
|
1014
|
-
integrationToRaw(integration) {
|
1015
|
-
return {
|
1016
|
-
id: integration.id,
|
1017
|
-
name: integration.name,
|
1018
|
-
type: integration.type,
|
1019
|
-
enabled: integration.enabled,
|
1020
|
-
syncing: integration.syncing,
|
1021
|
-
role_id: integration.roleID,
|
1022
|
-
enable_emoticons: integration.enableEmoticons,
|
1023
|
-
expire_behavior: integration.expireBehavior,
|
1024
|
-
expire_grace_period: integration.expireGracePeriod,
|
1025
|
-
user: integration.user !== undefined
|
1026
|
-
? this.userToRaw(integration.user)
|
1027
|
-
: undefined,
|
1028
|
-
account: integration.account,
|
1029
|
-
synced_at: integration.syncedAt,
|
1030
|
-
subscriber_count: integration.subscriberCount,
|
1031
|
-
revoked: integration.revoked,
|
1032
|
-
application: integration.application !== undefined
|
1033
|
-
? {
|
1034
|
-
id: integration.application.id,
|
1035
|
-
name: integration.application.name,
|
1036
|
-
icon: integration.application.icon,
|
1037
|
-
description: integration.application.description,
|
1038
|
-
bot: integration.application.bot !== undefined
|
1039
|
-
? this.userToRaw(integration.application.bot)
|
1040
|
-
: undefined,
|
1041
|
-
}
|
1042
|
-
: undefined,
|
1043
|
-
scopes: integration.scopes,
|
1044
|
-
};
|
1045
|
-
}
|
1046
|
-
interactionFromRaw(interaction) {
|
1047
|
-
return {
|
1048
|
-
id: interaction.id,
|
1049
|
-
applicationID: interaction.application_id,
|
1050
|
-
type: interaction.type,
|
1051
|
-
data: interaction.data !== undefined
|
1052
|
-
? {
|
1053
|
-
id: interaction.data.id,
|
1054
|
-
name: interaction.data.name,
|
1055
|
-
type: interaction.data.type,
|
1056
|
-
resolved: interaction.data.resolved !== undefined
|
1057
|
-
? this.resolvedDataFromRaw(interaction.data.resolved)
|
1058
|
-
: undefined,
|
1059
|
-
options: interaction.data.options,
|
1060
|
-
guildID: interaction.data.guild_id,
|
1061
|
-
targetID: interaction.data.target_id,
|
1062
|
-
customID: interaction.data.custom_id,
|
1063
|
-
componentType: interaction.data.component_type,
|
1064
|
-
values: interaction.data.values,
|
1065
|
-
components: interaction.data.components?.map((component) => ({
|
1066
|
-
type: component.type,
|
1067
|
-
components: component.components?.map((c) => ({
|
1068
|
-
type: c.type,
|
1069
|
-
customID: c.custom_id,
|
1070
|
-
style: c.style,
|
1071
|
-
label: c.label,
|
1072
|
-
minLength: c.min_length,
|
1073
|
-
maxLength: c.max_length,
|
1074
|
-
required: c.required,
|
1075
|
-
value: c.value,
|
1076
|
-
placeholder: c.placeholder,
|
1077
|
-
})),
|
1078
|
-
})),
|
1079
|
-
}
|
1080
|
-
: undefined,
|
1081
|
-
guild: interaction.guild !== undefined
|
1082
|
-
? {
|
1083
|
-
locale: interaction.guild.locale,
|
1084
|
-
id: interaction.guild.id,
|
1085
|
-
features: interaction.guild.features,
|
1086
|
-
}
|
1087
|
-
: undefined,
|
1088
|
-
guildID: interaction.guild_id,
|
1089
|
-
channel: interaction.channel !== undefined
|
1090
|
-
? this.channelFromRaw(interaction.channel)
|
1091
|
-
: undefined,
|
1092
|
-
channelID: interaction.channel_id,
|
1093
|
-
member: interaction.member !== undefined
|
1094
|
-
? this.guildMemberFromRaw(interaction.member)
|
1095
|
-
: undefined,
|
1096
|
-
user: interaction.user !== undefined
|
1097
|
-
? this.userFromRaw(interaction.user)
|
1098
|
-
: undefined,
|
1099
|
-
token: interaction.token,
|
1100
|
-
version: interaction.version,
|
1101
|
-
message: interaction.message !== undefined
|
1102
|
-
? this.messageFromRaw(interaction.message)
|
1103
|
-
: undefined,
|
1104
|
-
appPermissions: interaction.app_permissions,
|
1105
|
-
locale: interaction.locale,
|
1106
|
-
guildLocale: interaction.guild_locale,
|
1107
|
-
entitlements: interaction.entitlements.map((entitlement) => this.entitlementFromRaw(entitlement)),
|
1108
|
-
authorizingIntegrationOwners: {
|
1109
|
-
"0": interaction.authorizing_integration_owners[0],
|
1110
|
-
"1": interaction.authorizing_integration_owners[1],
|
1111
|
-
},
|
1112
|
-
context: interaction.context,
|
1113
|
-
};
|
1114
|
-
}
|
1115
|
-
interactionToRaw(interaction) {
|
1116
|
-
return {
|
1117
|
-
id: interaction.id,
|
1118
|
-
application_id: interaction.applicationID,
|
1119
|
-
type: interaction.type,
|
1120
|
-
data: interaction.data !== undefined
|
1121
|
-
? {
|
1122
|
-
id: interaction.data.id,
|
1123
|
-
name: interaction.data.name,
|
1124
|
-
type: interaction.data.type,
|
1125
|
-
resolved: interaction.data.resolved !== undefined
|
1126
|
-
? this.resolvedDataToRaw(interaction.data.resolved)
|
1127
|
-
: undefined,
|
1128
|
-
options: interaction.data.options,
|
1129
|
-
guild_id: interaction.data.guildID,
|
1130
|
-
target_id: interaction.data.targetID,
|
1131
|
-
custom_id: interaction.data.customID,
|
1132
|
-
component_type: interaction.data.componentType,
|
1133
|
-
values: interaction.data.values,
|
1134
|
-
components: interaction.data.components?.map((component) => ({
|
1135
|
-
type: component.type,
|
1136
|
-
components: component.components?.map((c) => ({
|
1137
|
-
type: c.type,
|
1138
|
-
custom_id: c.customID,
|
1139
|
-
style: c.style,
|
1140
|
-
label: c.label,
|
1141
|
-
min_length: c.minLength,
|
1142
|
-
max_length: c.maxLength,
|
1143
|
-
required: c.required,
|
1144
|
-
value: c.value,
|
1145
|
-
placeholder: c.placeholder,
|
1146
|
-
})),
|
1147
|
-
})),
|
1148
|
-
}
|
1149
|
-
: undefined,
|
1150
|
-
guild: interaction.guild !== undefined
|
1151
|
-
? {
|
1152
|
-
locale: interaction.guild.locale,
|
1153
|
-
id: interaction.guild.id,
|
1154
|
-
features: interaction.guild.features,
|
1155
|
-
}
|
1156
|
-
: undefined,
|
1157
|
-
guild_id: interaction.guildID,
|
1158
|
-
channel: interaction.channel !== undefined
|
1159
|
-
? this.channelToRaw(interaction.channel)
|
1160
|
-
: undefined,
|
1161
|
-
channel_id: interaction.channelID,
|
1162
|
-
member: interaction.member !== undefined
|
1163
|
-
? this.guildMemberToRaw(interaction.member)
|
1164
|
-
: undefined,
|
1165
|
-
user: interaction.user !== undefined
|
1166
|
-
? this.userToRaw(interaction.user)
|
1167
|
-
: undefined,
|
1168
|
-
token: interaction.token,
|
1169
|
-
version: interaction.version,
|
1170
|
-
message: interaction.message !== undefined
|
1171
|
-
? this.messageToRaw(interaction.message)
|
1172
|
-
: undefined,
|
1173
|
-
app_permissions: interaction.appPermissions,
|
1174
|
-
locale: interaction.locale,
|
1175
|
-
guild_locale: interaction.guildLocale,
|
1176
|
-
entitlements: interaction.entitlements.map((entitlement) => this.entitlementToRaw(entitlement)),
|
1177
|
-
authorizing_integration_owners: {
|
1178
|
-
"0": interaction.authorizingIntegrationOwners[0],
|
1179
|
-
"1": interaction.authorizingIntegrationOwners[1],
|
1180
|
-
},
|
1181
|
-
context: interaction.context,
|
1182
|
-
};
|
1183
|
-
}
|
1184
|
-
interactionMetadataFromRaw(interactionMetadata) {
|
1185
|
-
return {
|
1186
|
-
id: interactionMetadata.id,
|
1187
|
-
type: interactionMetadata.type,
|
1188
|
-
user: this.userFromRaw(interactionMetadata.user),
|
1189
|
-
authorizingIntegrationOwners: {
|
1190
|
-
"0": interactionMetadata.authorizing_integration_owners[0],
|
1191
|
-
"1": interactionMetadata.authorizing_integration_owners[1],
|
1192
|
-
},
|
1193
|
-
originalResponseMessageID: interactionMetadata.original_response_message_id,
|
1194
|
-
interactedMessageID: interactionMetadata.interacted_message_id,
|
1195
|
-
triggeringInteractionMetadata: interactionMetadata.triggering_interaction_metadata !== undefined
|
1196
|
-
? this.interactionMetadataFromRaw(interactionMetadata.triggering_interaction_metadata)
|
1197
|
-
: undefined,
|
1198
|
-
};
|
1199
|
-
}
|
1200
|
-
interactionMetadataToRaw(interactionMetadata) {
|
1201
|
-
return {
|
1202
|
-
id: interactionMetadata.id,
|
1203
|
-
type: interactionMetadata.type,
|
1204
|
-
user: this.userToRaw(interactionMetadata.user),
|
1205
|
-
authorizing_integration_owners: {
|
1206
|
-
"0": interactionMetadata.authorizingIntegrationOwners[0],
|
1207
|
-
"1": interactionMetadata.authorizingIntegrationOwners[1],
|
1208
|
-
},
|
1209
|
-
original_response_message_id: interactionMetadata.originalResponseMessageID,
|
1210
|
-
interacted_message_id: interactionMetadata.interactedMessageID,
|
1211
|
-
triggering_interaction_metadata: interactionMetadata.triggeringInteractionMetadata !== undefined
|
1212
|
-
? this.interactionMetadataToRaw(interactionMetadata.triggeringInteractionMetadata)
|
1213
|
-
: undefined,
|
1214
|
-
};
|
1215
|
-
}
|
1216
|
-
inviteFromRaw(invite) {
|
1217
|
-
return {
|
1218
|
-
type: invite.type,
|
1219
|
-
code: invite.code,
|
1220
|
-
guild: invite.guild !== undefined
|
1221
|
-
? this.guildFromRaw(invite.guild)
|
1222
|
-
: undefined,
|
1223
|
-
channel: this.channelFromRaw(invite.channel),
|
1224
|
-
inviter: invite.inviter !== undefined
|
1225
|
-
? this.userFromRaw(invite.inviter)
|
1226
|
-
: undefined,
|
1227
|
-
targetType: invite.target_type,
|
1228
|
-
targetUser: invite.target_user !== undefined
|
1229
|
-
? this.userFromRaw(invite.target_user)
|
1230
|
-
: undefined,
|
1231
|
-
targetApplication: invite.target_application !== undefined
|
1232
|
-
? this.applicationFromRaw(invite.target_application)
|
1233
|
-
: undefined,
|
1234
|
-
approximatePresenceCount: invite.approximate_presence_count,
|
1235
|
-
approximateMemberCount: invite.approximate_member_count,
|
1236
|
-
expiresAt: invite.expires_at,
|
1237
|
-
stageInstance: invite.stage_instance !== undefined
|
1238
|
-
? {
|
1239
|
-
members: invite.stage_instance.members.map((guildMember) => this.guildMemberFromRaw(guildMember)),
|
1240
|
-
participantCount: invite.stage_instance.participant_count,
|
1241
|
-
speakerCount: invite.stage_instance.speaker_count,
|
1242
|
-
topic: invite.stage_instance.topic,
|
1243
|
-
}
|
1244
|
-
: undefined,
|
1245
|
-
guildScheduledEvent: invite.guild_scheduled_event !== undefined
|
1246
|
-
? this.guildScheduledEventFromRaw(invite.guild_scheduled_event)
|
1247
|
-
: undefined,
|
1248
|
-
};
|
1249
|
-
}
|
1250
|
-
inviteToRaw(invite) {
|
1251
|
-
return {
|
1252
|
-
type: invite.type,
|
1253
|
-
code: invite.code,
|
1254
|
-
guild: invite.guild !== undefined ? this.guildToRaw(invite.guild) : undefined,
|
1255
|
-
channel: this.channelToRaw(invite.channel),
|
1256
|
-
inviter: invite.inviter !== undefined
|
1257
|
-
? this.userToRaw(invite.inviter)
|
1258
|
-
: undefined,
|
1259
|
-
target_type: invite.targetType,
|
1260
|
-
target_user: invite.targetUser !== undefined
|
1261
|
-
? this.userToRaw(invite.targetUser)
|
1262
|
-
: undefined,
|
1263
|
-
target_application: invite.targetApplication !== undefined
|
1264
|
-
? this.applicationToRaw(invite.targetApplication)
|
1265
|
-
: undefined,
|
1266
|
-
approximate_presence_count: invite.approximatePresenceCount,
|
1267
|
-
approximate_member_count: invite.approximateMemberCount,
|
1268
|
-
expires_at: invite.expiresAt,
|
1269
|
-
stage_instance: invite.stageInstance !== undefined
|
1270
|
-
? {
|
1271
|
-
members: invite.stageInstance.members.map((guildMember) => this.guildMemberToRaw(guildMember)),
|
1272
|
-
participant_count: invite.stageInstance.participantCount,
|
1273
|
-
speaker_count: invite.stageInstance.speakerCount,
|
1274
|
-
topic: invite.stageInstance.topic,
|
1275
|
-
}
|
1276
|
-
: undefined,
|
1277
|
-
guild_scheduled_event: invite.guildScheduledEvent !== undefined
|
1278
|
-
? this.guildScheduledEventToRaw(invite.guildScheduledEvent)
|
1279
|
-
: undefined,
|
1280
|
-
};
|
1281
|
-
}
|
1282
|
-
messageComponentsFromRaw(components) {
|
1283
|
-
return components.map((component) => ({
|
1284
|
-
type: component.type,
|
1285
|
-
components: component.components.map((c) => {
|
1286
|
-
switch (c.type) {
|
1287
|
-
case constants_1.ComponentTypes.Button: {
|
1288
|
-
return {
|
1289
|
-
type: c.type,
|
1290
|
-
style: c.style,
|
1291
|
-
label: c.label,
|
1292
|
-
emoji: c.emoji !== undefined
|
1293
|
-
? {
|
1294
|
-
name: c.emoji.name,
|
1295
|
-
id: c.emoji.id,
|
1296
|
-
animated: c.emoji.animated,
|
1297
|
-
}
|
1298
|
-
: undefined,
|
1299
|
-
customID: c.custom_id,
|
1300
|
-
skuID: c.sku_id,
|
1301
|
-
url: c.url,
|
1302
|
-
disabled: c.disabled,
|
1303
|
-
};
|
1304
|
-
}
|
1305
|
-
case constants_1.ComponentTypes.TextInput: {
|
1306
|
-
return {
|
1307
|
-
type: c.type,
|
1308
|
-
customID: c.custom_id,
|
1309
|
-
style: c.style,
|
1310
|
-
label: c.label,
|
1311
|
-
minLength: c.min_length,
|
1312
|
-
maxLength: c.max_length,
|
1313
|
-
required: c.required,
|
1314
|
-
value: c.value,
|
1315
|
-
placeholder: c.placeholder,
|
1316
|
-
};
|
1317
|
-
}
|
1318
|
-
case constants_1.ComponentTypes.ChannelSelect: {
|
1319
|
-
return {
|
1320
|
-
type: c.type,
|
1321
|
-
customID: c.custom_id,
|
1322
|
-
channelTypes: c.channel_types,
|
1323
|
-
placeholder: c.placeholder,
|
1324
|
-
defaultValues: c.default_values,
|
1325
|
-
minValues: c.min_values,
|
1326
|
-
maxValues: c.max_values,
|
1327
|
-
disabled: c.disabled,
|
1328
|
-
};
|
1329
|
-
}
|
1330
|
-
case constants_1.ComponentTypes.StringSelect: {
|
1331
|
-
return {
|
1332
|
-
type: c.type,
|
1333
|
-
customID: c.custom_id,
|
1334
|
-
placeholder: c.placeholder,
|
1335
|
-
options: c.options?.map((option) => ({
|
1336
|
-
label: option.label,
|
1337
|
-
value: option.value,
|
1338
|
-
description: option.description,
|
1339
|
-
emoji: option.emoji !== undefined
|
1340
|
-
? {
|
1341
|
-
name: option.emoji.name,
|
1342
|
-
id: option.emoji.id,
|
1343
|
-
animated: option.emoji.animated,
|
1344
|
-
}
|
1345
|
-
: undefined,
|
1346
|
-
default: option.default,
|
1347
|
-
})),
|
1348
|
-
minValues: c.min_values,
|
1349
|
-
maxValues: c.max_values,
|
1350
|
-
disabled: c.disabled,
|
1351
|
-
};
|
1352
|
-
}
|
1353
|
-
case constants_1.ComponentTypes.MentionableSelect:
|
1354
|
-
case constants_1.ComponentTypes.RoleSelect:
|
1355
|
-
case constants_1.ComponentTypes.UserSelect: {
|
1356
|
-
return {
|
1357
|
-
type: c.type,
|
1358
|
-
customID: c.custom_id,
|
1359
|
-
placeholder: c.placeholder,
|
1360
|
-
defaultValues: c.default_values,
|
1361
|
-
minValues: c.min_values,
|
1362
|
-
maxValues: c.max_values,
|
1363
|
-
disabled: c.disabled,
|
1364
|
-
};
|
1365
|
-
}
|
1366
|
-
}
|
1367
|
-
}),
|
1368
|
-
}));
|
1369
|
-
}
|
1370
|
-
messageComponentsToRaw(components) {
|
1371
|
-
return components.map((component) => ({
|
1372
|
-
type: component.type,
|
1373
|
-
components: component.components.map((c) => {
|
1374
|
-
switch (c.type) {
|
1375
|
-
case constants_1.ComponentTypes.Button: {
|
1376
|
-
return {
|
1377
|
-
type: c.type,
|
1378
|
-
style: c.style,
|
1379
|
-
label: c.label,
|
1380
|
-
emoji: c.emoji !== undefined
|
1381
|
-
? {
|
1382
|
-
name: c.emoji.name,
|
1383
|
-
id: c.emoji.id,
|
1384
|
-
animated: c.emoji.animated,
|
1385
|
-
}
|
1386
|
-
: undefined,
|
1387
|
-
custom_id: c.customID,
|
1388
|
-
sku_id: c.skuID,
|
1389
|
-
url: c.url,
|
1390
|
-
disabled: c.disabled,
|
1391
|
-
};
|
1392
|
-
}
|
1393
|
-
case constants_1.ComponentTypes.TextInput: {
|
1394
|
-
return {
|
1395
|
-
type: c.type,
|
1396
|
-
custom_id: c.customID,
|
1397
|
-
style: c.style,
|
1398
|
-
label: c.label,
|
1399
|
-
min_length: c.minLength,
|
1400
|
-
max_length: c.maxLength,
|
1401
|
-
required: c.required,
|
1402
|
-
value: c.value,
|
1403
|
-
placeholder: c.placeholder,
|
1404
|
-
};
|
1405
|
-
}
|
1406
|
-
case constants_1.ComponentTypes.ChannelSelect: {
|
1407
|
-
return {
|
1408
|
-
type: c.type,
|
1409
|
-
custom_id: c.customID,
|
1410
|
-
channel_types: c.channelTypes,
|
1411
|
-
placeholder: c.placeholder,
|
1412
|
-
default_values: c.defaultValues,
|
1413
|
-
min_values: c.minValues,
|
1414
|
-
max_values: c.maxValues,
|
1415
|
-
disabled: c.disabled,
|
1416
|
-
};
|
1417
|
-
}
|
1418
|
-
case constants_1.ComponentTypes.StringSelect: {
|
1419
|
-
return {
|
1420
|
-
type: c.type,
|
1421
|
-
custom_id: c.customID,
|
1422
|
-
placeholder: c.placeholder,
|
1423
|
-
options: c.options?.map((option) => ({
|
1424
|
-
label: option.label,
|
1425
|
-
value: option.value,
|
1426
|
-
description: option.description,
|
1427
|
-
emoji: option.emoji !== undefined
|
1428
|
-
? {
|
1429
|
-
name: option.emoji.name,
|
1430
|
-
id: option.emoji.id,
|
1431
|
-
animated: option.emoji.animated,
|
1432
|
-
}
|
1433
|
-
: undefined,
|
1434
|
-
default: option.default,
|
1435
|
-
})),
|
1436
|
-
min_values: c.minValues,
|
1437
|
-
max_values: c.maxValues,
|
1438
|
-
disabled: c.disabled,
|
1439
|
-
};
|
1440
|
-
}
|
1441
|
-
case constants_1.ComponentTypes.MentionableSelect:
|
1442
|
-
case constants_1.ComponentTypes.RoleSelect:
|
1443
|
-
case constants_1.ComponentTypes.UserSelect: {
|
1444
|
-
return {
|
1445
|
-
type: c.type,
|
1446
|
-
custom_id: c.customID,
|
1447
|
-
placeholder: c.placeholder,
|
1448
|
-
default_values: c.defaultValues,
|
1449
|
-
min_values: c.minValues,
|
1450
|
-
max_values: c.maxValues,
|
1451
|
-
disabled: c.disabled,
|
1452
|
-
};
|
1453
|
-
}
|
1454
|
-
}
|
1455
|
-
}),
|
1456
|
-
}));
|
1457
|
-
}
|
1458
|
-
messageFromRaw(message) {
|
1459
|
-
return {
|
1460
|
-
id: message.id,
|
1461
|
-
channelID: message.channel_id,
|
1462
|
-
author: this.userFromRaw(message.author),
|
1463
|
-
content: message.content,
|
1464
|
-
timestamp: message.timestamp,
|
1465
|
-
editedTimestamp: message.edited_timestamp,
|
1466
|
-
tts: message.tts,
|
1467
|
-
mentionEveryone: message.mention_everyone,
|
1468
|
-
mentions: message.mentions.map((user) => this.userFromRaw(user)),
|
1469
|
-
mentionRoles: message.mention_roles,
|
1470
|
-
mentionChannels: message.mention_channels?.map((channelMention) => ({
|
1471
|
-
id: channelMention.id,
|
1472
|
-
guildID: channelMention.guild_id,
|
1473
|
-
type: channelMention.type,
|
1474
|
-
name: channelMention.name,
|
1475
|
-
})),
|
1476
|
-
attachments: message.attachments.map((attachment) => this.attachmentFromRaw(attachment)),
|
1477
|
-
embeds: message.embeds,
|
1478
|
-
reactions: message.reactions?.map((reaction) => ({
|
1479
|
-
count: reaction.count,
|
1480
|
-
countDetails: reaction.count_details,
|
1481
|
-
me: reaction.me,
|
1482
|
-
meBurst: reaction.me_burst,
|
1483
|
-
emoji: this.emojiFromRaw(reaction.emoji),
|
1484
|
-
burstColors: reaction.burst_colors,
|
1485
|
-
})),
|
1486
|
-
nonce: message.nonce,
|
1487
|
-
pinned: message.pinned,
|
1488
|
-
webhookID: message.webhook_id,
|
1489
|
-
type: message.type,
|
1490
|
-
activity: message.activity,
|
1491
|
-
application: message.application !== undefined
|
1492
|
-
? this.applicationFromRaw(message.application)
|
1493
|
-
: undefined,
|
1494
|
-
applicationID: message.application_id,
|
1495
|
-
messageReference: message.message_reference !== undefined
|
1496
|
-
? {
|
1497
|
-
messageID: message.message_reference.message_id,
|
1498
|
-
channelID: message.message_reference.channel_id,
|
1499
|
-
guildID: message.message_reference.guild_id,
|
1500
|
-
failIfNotExists: message.message_reference.fail_if_not_exists,
|
1501
|
-
}
|
1502
|
-
: undefined,
|
1503
|
-
flags: message.flags,
|
1504
|
-
referencedMessage: message.referenced_message !== undefined
|
1505
|
-
? message.referenced_message !== null
|
1506
|
-
? this.messageFromRaw(message.referenced_message)
|
1507
|
-
: null
|
1508
|
-
: undefined,
|
1509
|
-
interactionMetadata: message.interaction_metadata !== undefined
|
1510
|
-
? this.interactionMetadataFromRaw(message.interaction_metadata)
|
1511
|
-
: undefined,
|
1512
|
-
interaction: message.interaction !== undefined
|
1513
|
-
? {
|
1514
|
-
id: message.interaction.id,
|
1515
|
-
type: message.interaction.type,
|
1516
|
-
name: message.interaction.name,
|
1517
|
-
user: this.userFromRaw(message.interaction.user),
|
1518
|
-
member: message.interaction.member !== undefined
|
1519
|
-
? this.guildMemberFromRaw(message.interaction.member)
|
1520
|
-
: undefined,
|
1521
|
-
}
|
1522
|
-
: undefined,
|
1523
|
-
thread: message.thread !== undefined
|
1524
|
-
? this.channelFromRaw(message.thread)
|
1525
|
-
: undefined,
|
1526
|
-
components: message.components !== undefined
|
1527
|
-
? this.messageComponentsFromRaw(message.components)
|
1528
|
-
: undefined,
|
1529
|
-
stickerItems: message.sticker_items?.map((stickerItem) => ({
|
1530
|
-
id: stickerItem.id,
|
1531
|
-
name: stickerItem.name,
|
1532
|
-
formatType: stickerItem.format_type,
|
1533
|
-
})),
|
1534
|
-
stickers: message.stickers?.map((sticker) => this.stickerFromRaw(sticker)),
|
1535
|
-
position: message.position,
|
1536
|
-
roleSubscriptionData: message.role_subscription_data !== undefined
|
1537
|
-
? {
|
1538
|
-
roleSubscriptionListingID: message.role_subscription_data.role_subscription_listing_id,
|
1539
|
-
tierName: message.role_subscription_data.tier_name,
|
1540
|
-
totalMonthsSubscribed: message.role_subscription_data.total_months_subscribed,
|
1541
|
-
isRenewal: message.role_subscription_data.is_renewal,
|
1542
|
-
}
|
1543
|
-
: undefined,
|
1544
|
-
resolved: message.resolved !== undefined
|
1545
|
-
? this.resolvedDataFromRaw(message.resolved)
|
1546
|
-
: undefined,
|
1547
|
-
poll: message.poll !== undefined ? this.pollFromRaw(message.poll) : undefined,
|
1548
|
-
call: message.call,
|
1549
|
-
};
|
1550
|
-
}
|
1551
|
-
messageToRaw(message) {
|
1552
|
-
return {
|
1553
|
-
id: message.id,
|
1554
|
-
channel_id: message.channelID,
|
1555
|
-
author: this.userToRaw(message.author),
|
1556
|
-
content: message.content,
|
1557
|
-
timestamp: message.timestamp,
|
1558
|
-
edited_timestamp: message.editedTimestamp,
|
1559
|
-
tts: message.tts,
|
1560
|
-
mention_everyone: message.mentionEveryone,
|
1561
|
-
mentions: message.mentions.map((user) => this.userToRaw(user)),
|
1562
|
-
mention_roles: message.mentionRoles,
|
1563
|
-
mention_channels: message.mentionChannels?.map((channelMention) => ({
|
1564
|
-
id: channelMention.id,
|
1565
|
-
guild_id: channelMention.guildID,
|
1566
|
-
type: channelMention.type,
|
1567
|
-
name: channelMention.name,
|
1568
|
-
})),
|
1569
|
-
attachments: message.attachments.map((attachment) => this.attachmentToRaw(attachment)),
|
1570
|
-
embeds: message.embeds,
|
1571
|
-
reactions: message.reactions?.map((reaction) => ({
|
1572
|
-
count: reaction.count,
|
1573
|
-
count_details: reaction.countDetails,
|
1574
|
-
me: reaction.me,
|
1575
|
-
me_burst: reaction.meBurst,
|
1576
|
-
emoji: this.emojiToRaw(reaction.emoji),
|
1577
|
-
burst_colors: reaction.burstColors,
|
1578
|
-
})),
|
1579
|
-
nonce: message.nonce,
|
1580
|
-
pinned: message.pinned,
|
1581
|
-
webhook_id: message.webhookID,
|
1582
|
-
type: message.type,
|
1583
|
-
activity: message.activity,
|
1584
|
-
application: message.application !== undefined
|
1585
|
-
? this.applicationToRaw(message.application)
|
1586
|
-
: undefined,
|
1587
|
-
application_id: message.applicationID,
|
1588
|
-
message_reference: message.messageReference !== undefined
|
1589
|
-
? {
|
1590
|
-
message_id: message.messageReference.messageID,
|
1591
|
-
channel_id: message.messageReference.channelID,
|
1592
|
-
guild_id: message.messageReference.guildID,
|
1593
|
-
fail_if_not_exists: message.messageReference.failIfNotExists,
|
1594
|
-
}
|
1595
|
-
: undefined,
|
1596
|
-
flags: message.flags,
|
1597
|
-
referenced_message: message.referencedMessage !== undefined
|
1598
|
-
? message.referencedMessage !== null
|
1599
|
-
? this.messageToRaw(message.referencedMessage)
|
1600
|
-
: null
|
1601
|
-
: undefined,
|
1602
|
-
interaction_metadata: message.interactionMetadata !== undefined
|
1603
|
-
? this.interactionMetadataToRaw(message.interactionMetadata)
|
1604
|
-
: undefined,
|
1605
|
-
interaction: message.interaction !== undefined
|
1606
|
-
? {
|
1607
|
-
id: message.interaction.id,
|
1608
|
-
type: message.interaction.type,
|
1609
|
-
name: message.interaction.name,
|
1610
|
-
user: this.userToRaw(message.interaction.user),
|
1611
|
-
member: message.interaction.member !== undefined
|
1612
|
-
? this.guildMemberToRaw(message.interaction.member)
|
1613
|
-
: undefined,
|
1614
|
-
}
|
1615
|
-
: undefined,
|
1616
|
-
thread: message.thread !== undefined
|
1617
|
-
? this.channelToRaw(message.thread)
|
1618
|
-
: undefined,
|
1619
|
-
components: message.components !== undefined
|
1620
|
-
? this.messageComponentsToRaw(message.components)
|
1621
|
-
: undefined,
|
1622
|
-
sticker_items: message.stickerItems?.map((stickerItem) => ({
|
1623
|
-
id: stickerItem.id,
|
1624
|
-
name: stickerItem.name,
|
1625
|
-
format_type: stickerItem.formatType,
|
1626
|
-
})),
|
1627
|
-
stickers: message.stickers?.map((sticker) => this.stickerToRaw(sticker)),
|
1628
|
-
position: message.position,
|
1629
|
-
role_subscription_data: message.roleSubscriptionData !== undefined
|
1630
|
-
? {
|
1631
|
-
role_subscription_listing_id: message.roleSubscriptionData.roleSubscriptionListingID,
|
1632
|
-
tier_name: message.roleSubscriptionData.tierName,
|
1633
|
-
total_months_subscribed: message.roleSubscriptionData.totalMonthsSubscribed,
|
1634
|
-
is_renewal: message.roleSubscriptionData.isRenewal,
|
1635
|
-
}
|
1636
|
-
: undefined,
|
1637
|
-
resolved: message.resolved !== undefined
|
1638
|
-
? this.resolvedDataToRaw(message.resolved)
|
1639
|
-
: undefined,
|
1640
|
-
poll: message.poll !== undefined ? this.pollToRaw(message.poll) : undefined,
|
1641
|
-
call: message.call,
|
1642
|
-
};
|
1643
|
-
}
|
1644
|
-
partialApplicationCommandToRaw(applicationCommand) {
|
1645
|
-
return {
|
1646
|
-
id: applicationCommand.id,
|
1647
|
-
type: applicationCommand.type,
|
1648
|
-
application_id: applicationCommand.applicationID,
|
1649
|
-
guild_id: applicationCommand.guildID,
|
1650
|
-
name: applicationCommand.name,
|
1651
|
-
name_localizations: applicationCommand.nameLocalizations,
|
1652
|
-
description: applicationCommand.description,
|
1653
|
-
description_localizations: applicationCommand.descriptionLocalizations,
|
1654
|
-
options: applicationCommand.options?.map((option) => ({
|
1655
|
-
type: option.type,
|
1656
|
-
name: option.name,
|
1657
|
-
name_localizations: option.nameLocalizations,
|
1658
|
-
description: option.description,
|
1659
|
-
description_localizations: option.descriptionLocalizations,
|
1660
|
-
required: option.required,
|
1661
|
-
choices: option.choices?.map((choice) => ({
|
1662
|
-
name: choice.name,
|
1663
|
-
name_localizations: choice.nameLocalizations,
|
1664
|
-
value: choice.value,
|
1665
|
-
})),
|
1666
|
-
options: option.options?.map((o) => ({
|
1667
|
-
type: o.type,
|
1668
|
-
name: o.name,
|
1669
|
-
name_localizations: o.nameLocalizations,
|
1670
|
-
description: o.description,
|
1671
|
-
description_localizations: o.descriptionLocalizations,
|
1672
|
-
required: o.required,
|
1673
|
-
choices: o.choices?.map((choice) => ({
|
1674
|
-
name: choice.name,
|
1675
|
-
name_localizations: choice.nameLocalizations,
|
1676
|
-
value: choice.value,
|
1677
|
-
})),
|
1678
|
-
channel_types: o.channelTypes,
|
1679
|
-
min_value: o.minValue,
|
1680
|
-
max_value: o.maxValue,
|
1681
|
-
min_length: o.minLength,
|
1682
|
-
max_length: o.maxLength,
|
1683
|
-
autocomplete: o.autocomplete,
|
1684
|
-
})),
|
1685
|
-
channel_types: option.channelTypes,
|
1686
|
-
min_value: option.minValue,
|
1687
|
-
max_value: option.maxValue,
|
1688
|
-
min_length: option.minLength,
|
1689
|
-
max_length: option.maxLength,
|
1690
|
-
autocomplete: option.autocomplete,
|
1691
|
-
})),
|
1692
|
-
default_member_permissions: applicationCommand.defaultMemberPermissions,
|
1693
|
-
dm_permission: applicationCommand.dmPermission,
|
1694
|
-
default_permission: applicationCommand.defaultPermission,
|
1695
|
-
nsfw: applicationCommand.nsfw,
|
1696
|
-
version: applicationCommand.version,
|
1697
|
-
};
|
1698
|
-
}
|
1699
|
-
presenceFromRaw(presence) {
|
1700
|
-
return {
|
1701
|
-
user: this.userFromRaw(presence.user),
|
1702
|
-
guildID: presence.guild_id,
|
1703
|
-
status: presence.status,
|
1704
|
-
activities: presence.activities.map((activity) => ({
|
1705
|
-
name: activity.name,
|
1706
|
-
type: activity.type,
|
1707
|
-
url: activity.url,
|
1708
|
-
createdAt: activity.created_at,
|
1709
|
-
timestamps: activity.timestamps,
|
1710
|
-
applicationID: activity.application_id,
|
1711
|
-
details: activity.details,
|
1712
|
-
state: activity.state,
|
1713
|
-
party: activity.party,
|
1714
|
-
assets: {
|
1715
|
-
largeImage: activity.assets?.large_image,
|
1716
|
-
largeText: activity.assets?.large_text,
|
1717
|
-
smallImage: activity.assets?.small_image,
|
1718
|
-
smallText: activity.assets?.small_text,
|
1719
|
-
},
|
1720
|
-
secrets: activity.secrets,
|
1721
|
-
instance: activity.instance,
|
1722
|
-
flags: activity.flags,
|
1723
|
-
buttons: activity.buttons,
|
1724
|
-
})),
|
1725
|
-
clientStatus: presence.client_status,
|
1726
|
-
};
|
1727
|
-
}
|
1728
|
-
presenceToRaw(presence) {
|
1729
|
-
return {
|
1730
|
-
user: this.userToRaw(presence.user),
|
1731
|
-
guild_id: presence.guildID,
|
1732
|
-
status: presence.status,
|
1733
|
-
activities: presence.activities.map((activity) => ({
|
1734
|
-
name: activity.name,
|
1735
|
-
type: activity.type,
|
1736
|
-
url: activity.url,
|
1737
|
-
created_at: activity.createdAt,
|
1738
|
-
timestamps: activity.timestamps,
|
1739
|
-
application_id: activity.applicationID,
|
1740
|
-
details: activity.details,
|
1741
|
-
state: activity.state,
|
1742
|
-
party: activity.party,
|
1743
|
-
assets: {
|
1744
|
-
large_image: activity.assets?.largeImage,
|
1745
|
-
large_text: activity.assets?.largeText,
|
1746
|
-
small_image: activity.assets?.smallImage,
|
1747
|
-
small_text: activity.assets?.smallText,
|
1748
|
-
},
|
1749
|
-
secrets: activity.secrets,
|
1750
|
-
instance: activity.instance,
|
1751
|
-
flags: activity.flags,
|
1752
|
-
buttons: activity.buttons,
|
1753
|
-
})),
|
1754
|
-
client_status: presence.clientStatus,
|
1755
|
-
};
|
1756
|
-
}
|
1757
|
-
resolvedDataFromRaw(resolvedData) {
|
1758
|
-
let users = {};
|
1759
|
-
let members = {};
|
1760
|
-
let roles = {};
|
1761
|
-
let channels = {};
|
1762
|
-
let messages = {};
|
1763
|
-
let attachments = {};
|
1764
|
-
if (resolvedData.users !== undefined) {
|
1765
|
-
for (const [key, value] of Object.entries(resolvedData.users)) {
|
1766
|
-
users[key] = this.userFromRaw(value);
|
1767
|
-
}
|
1768
|
-
}
|
1769
|
-
if (resolvedData.members !== undefined) {
|
1770
|
-
for (const [key, value] of Object.entries(resolvedData.members)) {
|
1771
|
-
members[key] = this.guildMemberFromRaw(value);
|
1772
|
-
}
|
1773
|
-
}
|
1774
|
-
if (resolvedData.roles !== undefined) {
|
1775
|
-
for (const [key, value] of Object.entries(resolvedData.roles)) {
|
1776
|
-
roles[key] = this.roleFromRaw(value);
|
1777
|
-
}
|
1778
|
-
}
|
1779
|
-
if (resolvedData.channels !== undefined) {
|
1780
|
-
for (const [key, value] of Object.entries(resolvedData.channels)) {
|
1781
|
-
channels[key] = this.channelFromRaw(value);
|
1782
|
-
}
|
1783
|
-
}
|
1784
|
-
if (resolvedData.messages !== undefined) {
|
1785
|
-
for (const [key, value] of Object.entries(resolvedData.messages)) {
|
1786
|
-
messages[key] = this.messageFromRaw(value);
|
1787
|
-
}
|
1788
|
-
}
|
1789
|
-
if (resolvedData.attachments !== undefined) {
|
1790
|
-
for (const [key, value] of Object.entries(resolvedData.attachments)) {
|
1791
|
-
attachments[key] = this.attachmentFromRaw(value);
|
1792
|
-
}
|
1793
|
-
}
|
1794
|
-
return {
|
1795
|
-
users,
|
1796
|
-
members,
|
1797
|
-
roles,
|
1798
|
-
channels,
|
1799
|
-
messages,
|
1800
|
-
attachments,
|
1801
|
-
};
|
1802
|
-
}
|
1803
|
-
resolvedDataToRaw(resolvedData) {
|
1804
|
-
let users = {};
|
1805
|
-
let members = {};
|
1806
|
-
let roles = {};
|
1807
|
-
let channels = {};
|
1808
|
-
let messages = {};
|
1809
|
-
let attachments = {};
|
1810
|
-
if (resolvedData.users !== undefined) {
|
1811
|
-
for (const [key, value] of Object.entries(resolvedData.users)) {
|
1812
|
-
users[key] = this.userToRaw(value);
|
1813
|
-
}
|
1814
|
-
}
|
1815
|
-
if (resolvedData.members !== undefined) {
|
1816
|
-
for (const [key, value] of Object.entries(resolvedData.members)) {
|
1817
|
-
members[key] = this.guildMemberToRaw(value);
|
1818
|
-
}
|
1819
|
-
}
|
1820
|
-
if (resolvedData.roles !== undefined) {
|
1821
|
-
for (const [key, value] of Object.entries(resolvedData.roles)) {
|
1822
|
-
roles[key] = this.roleToRaw(value);
|
1823
|
-
}
|
1824
|
-
}
|
1825
|
-
if (resolvedData.channels !== undefined) {
|
1826
|
-
for (const [key, value] of Object.entries(resolvedData.channels)) {
|
1827
|
-
channels[key] = this.channelToRaw(value);
|
1828
|
-
}
|
1829
|
-
}
|
1830
|
-
if (resolvedData.messages !== undefined) {
|
1831
|
-
for (const [key, value] of Object.entries(resolvedData.messages)) {
|
1832
|
-
messages[key] = this.messageToRaw(value);
|
1833
|
-
}
|
1834
|
-
}
|
1835
|
-
if (resolvedData.attachments !== undefined) {
|
1836
|
-
for (const [key, value] of Object.entries(resolvedData.attachments)) {
|
1837
|
-
attachments[key] = this.attachmentToRaw(value);
|
1838
|
-
}
|
1839
|
-
}
|
1840
|
-
return {
|
1841
|
-
users,
|
1842
|
-
members,
|
1843
|
-
roles,
|
1844
|
-
channels,
|
1845
|
-
messages,
|
1846
|
-
attachments,
|
1847
|
-
};
|
1848
|
-
}
|
1849
|
-
pollFromRaw(poll) {
|
1850
|
-
return {
|
1851
|
-
question: poll.question,
|
1852
|
-
answers: poll.answers.map((answer) => ({
|
1853
|
-
answerID: answer.answer_id,
|
1854
|
-
pollMedia: answer.poll_media,
|
1855
|
-
})),
|
1856
|
-
expiry: poll.expiry,
|
1857
|
-
allowMultiselect: poll.allow_multiselect,
|
1858
|
-
layoutType: poll.layout_type,
|
1859
|
-
results: poll.results !== undefined
|
1860
|
-
? {
|
1861
|
-
isFinalized: poll.results.is_finalized,
|
1862
|
-
answerCounts: poll.results.answer_counts.map((answerCount) => ({
|
1863
|
-
id: answerCount.id,
|
1864
|
-
count: answerCount.count,
|
1865
|
-
meVoted: answerCount.me_voted,
|
1866
|
-
})),
|
1867
|
-
}
|
1868
|
-
: undefined,
|
1869
|
-
};
|
1870
|
-
}
|
1871
|
-
pollToRaw(poll) {
|
1872
|
-
return {
|
1873
|
-
question: poll.question,
|
1874
|
-
answers: poll.answers.map((answer) => ({
|
1875
|
-
answer_id: answer.answerID,
|
1876
|
-
poll_media: answer.pollMedia,
|
1877
|
-
})),
|
1878
|
-
expiry: poll.expiry,
|
1879
|
-
allow_multiselect: poll.allowMultiselect,
|
1880
|
-
layout_type: poll.layoutType,
|
1881
|
-
results: poll.results !== undefined
|
1882
|
-
? {
|
1883
|
-
is_finalized: poll.results.isFinalized,
|
1884
|
-
answer_counts: poll.results.answerCounts.map((answerCount) => ({
|
1885
|
-
id: answerCount.id,
|
1886
|
-
count: answerCount.count,
|
1887
|
-
me_voted: answerCount.meVoted,
|
1888
|
-
})),
|
1889
|
-
}
|
1890
|
-
: undefined,
|
1891
|
-
};
|
1892
|
-
}
|
1893
|
-
roleFromRaw(role) {
|
1894
|
-
return {
|
1895
|
-
id: role.id,
|
1896
|
-
name: role.name,
|
1897
|
-
color: role.color,
|
1898
|
-
hoist: role.hoist,
|
1899
|
-
icon: role.icon,
|
1900
|
-
unicodeEmoji: role.unicode_emoji,
|
1901
|
-
position: role.position,
|
1902
|
-
permissions: role.permissions,
|
1903
|
-
managed: role.managed,
|
1904
|
-
mentionable: role.mentionable,
|
1905
|
-
tags: role.tags !== undefined
|
1906
|
-
? {
|
1907
|
-
botID: role.tags.bot_id,
|
1908
|
-
integrationID: role.tags.integration_id,
|
1909
|
-
premiumSubscriber: role.tags.premium_subscriber,
|
1910
|
-
subscriptionListingID: role.tags.subscription_listing_id,
|
1911
|
-
availableForPurchase: role.tags.available_for_purchase,
|
1912
|
-
guildConnections: role.tags.guild_connections,
|
1913
|
-
}
|
1914
|
-
: undefined,
|
1915
|
-
flags: role.flags,
|
1916
|
-
};
|
1917
|
-
}
|
1918
|
-
roleToRaw(role) {
|
1919
|
-
return {
|
1920
|
-
id: role.id,
|
1921
|
-
name: role.name,
|
1922
|
-
color: role.color,
|
1923
|
-
hoist: role.hoist,
|
1924
|
-
icon: role.icon,
|
1925
|
-
unicode_emoji: role.unicodeEmoji,
|
1926
|
-
position: role.position,
|
1927
|
-
permissions: role.permissions,
|
1928
|
-
managed: role.managed,
|
1929
|
-
mentionable: role.mentionable,
|
1930
|
-
tags: role.tags !== undefined
|
1931
|
-
? {
|
1932
|
-
bot_id: role.tags.botID,
|
1933
|
-
integration_id: role.tags.integrationID,
|
1934
|
-
premium_subscriber: role.tags.premiumSubscriber,
|
1935
|
-
subscription_listing_id: role.tags.subscriptionListingID,
|
1936
|
-
available_for_purchase: role.tags.availableForPurchase,
|
1937
|
-
guild_connections: role.tags.guildConnections,
|
1938
|
-
}
|
1939
|
-
: undefined,
|
1940
|
-
flags: role.flags,
|
1941
|
-
};
|
1942
|
-
}
|
1943
|
-
skuFromRaw(sku) {
|
1944
|
-
return {
|
1945
|
-
id: sku.id,
|
1946
|
-
type: sku.type,
|
1947
|
-
dependentSKUID: sku.dependent_sku_id,
|
1948
|
-
applicationID: sku.application_id,
|
1949
|
-
manifestLabels: sku.manifest_labels,
|
1950
|
-
accessType: sku.access_type,
|
1951
|
-
name: sku.name,
|
1952
|
-
features: sku.features,
|
1953
|
-
releaseDate: sku.release_date,
|
1954
|
-
slug: sku.slug,
|
1955
|
-
flags: sku.flags,
|
1956
|
-
showAgeGate: sku.show_age_gate,
|
1957
|
-
};
|
1958
|
-
}
|
1959
|
-
skuToRaw(sku) {
|
1960
|
-
return {
|
1961
|
-
id: sku.id,
|
1962
|
-
type: sku.type,
|
1963
|
-
dependent_sku_id: sku.dependentSKUID,
|
1964
|
-
application_id: sku.applicationID,
|
1965
|
-
manifest_labels: sku.manifestLabels,
|
1966
|
-
access_type: sku.accessType,
|
1967
|
-
name: sku.name,
|
1968
|
-
features: sku.features,
|
1969
|
-
release_date: sku.releaseDate,
|
1970
|
-
slug: sku.slug,
|
1971
|
-
flags: sku.flags,
|
1972
|
-
show_age_gate: sku.showAgeGate,
|
1973
|
-
};
|
1974
|
-
}
|
1975
|
-
stageInstanceFromRaw(stageInstance) {
|
1976
|
-
return {
|
1977
|
-
id: stageInstance.id,
|
1978
|
-
guildID: stageInstance.guild_id,
|
1979
|
-
channelID: stageInstance.channel_id,
|
1980
|
-
topic: stageInstance.topic,
|
1981
|
-
privacyLevel: stageInstance.privacy_level,
|
1982
|
-
discoverableDisabled: stageInstance.discoverable_disabled,
|
1983
|
-
guildScheduledEventID: stageInstance.guild_scheduled_event_id,
|
1984
|
-
};
|
1985
|
-
}
|
1986
|
-
stageInstanceToRaw(stageInstance) {
|
1987
|
-
return {
|
1988
|
-
id: stageInstance.id,
|
1989
|
-
guild_id: stageInstance.guildID,
|
1990
|
-
channel_id: stageInstance.channelID,
|
1991
|
-
topic: stageInstance.topic,
|
1992
|
-
privacy_level: stageInstance.privacyLevel,
|
1993
|
-
discoverable_disabled: stageInstance.discoverableDisabled,
|
1994
|
-
guild_scheduled_event_id: stageInstance.guildScheduledEventID,
|
1995
|
-
};
|
1996
|
-
}
|
1997
|
-
stickerFromRaw(sticker) {
|
1998
|
-
return {
|
1999
|
-
id: sticker.id,
|
2000
|
-
packID: sticker.pack_id,
|
2001
|
-
name: sticker.name,
|
2002
|
-
description: sticker.description,
|
2003
|
-
tags: sticker.tags,
|
2004
|
-
asset: sticker.asset,
|
2005
|
-
type: sticker.type,
|
2006
|
-
formatType: sticker.format_type,
|
2007
|
-
available: sticker.available,
|
2008
|
-
guildID: sticker.id,
|
2009
|
-
user: sticker.user !== undefined ? this.userFromRaw(sticker.user) : undefined,
|
2010
|
-
sortValue: sticker.sort_value,
|
2011
|
-
};
|
2012
|
-
}
|
2013
|
-
stickerToRaw(sticker) {
|
2014
|
-
return {
|
2015
|
-
id: sticker.id,
|
2016
|
-
pack_id: sticker.packID,
|
2017
|
-
name: sticker.name,
|
2018
|
-
description: sticker.description,
|
2019
|
-
tags: sticker.tags,
|
2020
|
-
asset: sticker.asset,
|
2021
|
-
type: sticker.type,
|
2022
|
-
format_type: sticker.formatType,
|
2023
|
-
available: sticker.available,
|
2024
|
-
guild_id: sticker.id,
|
2025
|
-
user: sticker.user !== undefined ? this.userToRaw(sticker.user) : undefined,
|
2026
|
-
sort_value: sticker.sortValue,
|
2027
|
-
};
|
2028
|
-
}
|
2029
|
-
teamFromRaw(team) {
|
2030
|
-
return {
|
2031
|
-
icon: team.icon,
|
2032
|
-
id: team.id,
|
2033
|
-
members: team.members.map((teamMember) => ({
|
2034
|
-
membershipState: teamMember.membership_state,
|
2035
|
-
teamID: teamMember.team_id,
|
2036
|
-
user: this.userFromRaw(teamMember.user),
|
2037
|
-
role: teamMember.role,
|
2038
|
-
})),
|
2039
|
-
name: team.name,
|
2040
|
-
ownerUserID: team.owner_user_id,
|
2041
|
-
};
|
2042
|
-
}
|
2043
|
-
teamToRaw(team) {
|
2044
|
-
return {
|
2045
|
-
icon: team.icon,
|
2046
|
-
id: team.id,
|
2047
|
-
members: team.members.map((teamMember) => ({
|
2048
|
-
membership_state: teamMember.membershipState,
|
2049
|
-
team_id: teamMember.teamID,
|
2050
|
-
user: this.userToRaw(teamMember.user),
|
2051
|
-
role: teamMember.role,
|
2052
|
-
})),
|
2053
|
-
name: team.name,
|
2054
|
-
owner_user_id: team.ownerUserID,
|
2055
|
-
};
|
2056
|
-
}
|
2057
|
-
threadMemberFromRaw(threadMember) {
|
2058
|
-
return {
|
2059
|
-
id: threadMember.id,
|
2060
|
-
userID: threadMember.user_id,
|
2061
|
-
joinTimestamp: threadMember.join_timestamp,
|
2062
|
-
flags: threadMember.flags,
|
2063
|
-
member: threadMember.member !== undefined
|
2064
|
-
? this.guildMemberFromRaw(threadMember.member)
|
2065
|
-
: undefined,
|
2066
|
-
};
|
2067
|
-
}
|
2068
|
-
threadMemberToRaw(threadMember) {
|
2069
|
-
return {
|
2070
|
-
id: threadMember.id,
|
2071
|
-
user_id: threadMember.userID,
|
2072
|
-
join_timestamp: threadMember.joinTimestamp,
|
2073
|
-
flags: threadMember.flags,
|
2074
|
-
member: threadMember.member !== undefined
|
2075
|
-
? this.guildMemberToRaw(threadMember.member)
|
2076
|
-
: undefined,
|
2077
|
-
};
|
2078
|
-
}
|
2079
|
-
testEntitlementFromRaw(entitlement) {
|
2080
|
-
return {
|
2081
|
-
id: entitlement.id,
|
2082
|
-
skuID: entitlement.sku_id,
|
2083
|
-
applicationID: entitlement.application_id,
|
2084
|
-
userID: entitlement.user_id,
|
2085
|
-
promotionID: entitlement.promotion_id,
|
2086
|
-
type: entitlement.type,
|
2087
|
-
deleted: entitlement.deleted,
|
2088
|
-
giftCodeFlags: entitlement.gift_code_flags,
|
2089
|
-
consumed: entitlement.consumed,
|
2090
|
-
guildID: entitlement.guild_id,
|
2091
|
-
};
|
2092
|
-
}
|
2093
|
-
testEntitlementToRaw(entitlement) {
|
2094
|
-
return {
|
2095
|
-
id: entitlement.id,
|
2096
|
-
sku_id: entitlement.skuID,
|
2097
|
-
application_id: entitlement.applicationID,
|
2098
|
-
user_id: entitlement.userID,
|
2099
|
-
promotion_id: entitlement.promotionID,
|
2100
|
-
type: entitlement.type,
|
2101
|
-
deleted: entitlement.deleted,
|
2102
|
-
gift_code_flags: entitlement.giftCodeFlags,
|
2103
|
-
consumed: entitlement.consumed,
|
2104
|
-
guild_id: entitlement.guildID,
|
2105
|
-
};
|
2106
|
-
}
|
2107
|
-
userFromRaw(user) {
|
2108
|
-
return {
|
2109
|
-
id: user.id,
|
2110
|
-
username: user.username,
|
2111
|
-
discriminator: user.discriminator,
|
2112
|
-
globalName: user.global_name,
|
2113
|
-
avatar: user.avatar,
|
2114
|
-
bot: user.bot,
|
2115
|
-
system: user.system,
|
2116
|
-
mfaEnabled: user.mfa_enabled,
|
2117
|
-
banner: user.banner,
|
2118
|
-
accentColor: user.accent_color,
|
2119
|
-
locale: user.locale,
|
2120
|
-
verified: user.verified,
|
2121
|
-
email: user.email,
|
2122
|
-
flags: user.flags,
|
2123
|
-
premiumType: user.premium_type,
|
2124
|
-
publicFlags: user.public_flags,
|
2125
|
-
avatarDecoration: user.avatar_decoration,
|
2126
|
-
};
|
2127
|
-
}
|
2128
|
-
userToRaw(user) {
|
2129
|
-
return {
|
2130
|
-
id: user.id,
|
2131
|
-
username: user.username,
|
2132
|
-
discriminator: user.discriminator,
|
2133
|
-
global_name: user.globalName,
|
2134
|
-
avatar: user.avatar,
|
2135
|
-
bot: user.bot,
|
2136
|
-
system: user.system,
|
2137
|
-
mfa_enabled: user.mfaEnabled,
|
2138
|
-
banner: user.banner,
|
2139
|
-
accent_color: user.accentColor,
|
2140
|
-
locale: user.locale,
|
2141
|
-
verified: user.verified,
|
2142
|
-
email: user.email,
|
2143
|
-
flags: user.flags,
|
2144
|
-
premium_type: user.premiumType,
|
2145
|
-
public_flags: user.publicFlags,
|
2146
|
-
avatar_decoration: user.avatarDecoration,
|
2147
|
-
};
|
2148
|
-
}
|
2149
|
-
voiceStateFromRaw(voiceState) {
|
2150
|
-
return {
|
2151
|
-
guildID: voiceState.guild_id,
|
2152
|
-
channelID: voiceState.channel_id,
|
2153
|
-
userID: voiceState.user_id,
|
2154
|
-
member: voiceState.member !== undefined
|
2155
|
-
? this.guildMemberFromRaw(voiceState.member)
|
2156
|
-
: undefined,
|
2157
|
-
sessionID: voiceState.session_id,
|
2158
|
-
deaf: voiceState.deaf,
|
2159
|
-
mute: voiceState.mute,
|
2160
|
-
selfDeaf: voiceState.self_deaf,
|
2161
|
-
selfMute: voiceState.self_mute,
|
2162
|
-
selfStream: voiceState.self_stream,
|
2163
|
-
selfVideo: voiceState.self_video,
|
2164
|
-
suppress: voiceState.suppress,
|
2165
|
-
requestToSpeakTimestamp: voiceState.request_to_speak_timestamp,
|
2166
|
-
};
|
2167
|
-
}
|
2168
|
-
voiceStateToRaw(voiceState) {
|
2169
|
-
return {
|
2170
|
-
guild_id: voiceState.guildID,
|
2171
|
-
channel_id: voiceState.channelID,
|
2172
|
-
user_id: voiceState.userID,
|
2173
|
-
member: voiceState.member !== undefined
|
2174
|
-
? this.guildMemberToRaw(voiceState.member)
|
2175
|
-
: undefined,
|
2176
|
-
session_id: voiceState.sessionID,
|
2177
|
-
deaf: voiceState.deaf,
|
2178
|
-
mute: voiceState.mute,
|
2179
|
-
self_deaf: voiceState.selfDeaf,
|
2180
|
-
self_mute: voiceState.selfMute,
|
2181
|
-
self_stream: voiceState.selfStream,
|
2182
|
-
self_video: voiceState.selfVideo,
|
2183
|
-
suppress: voiceState.suppress,
|
2184
|
-
request_to_speak_timestamp: voiceState.requestToSpeakTimestamp,
|
2185
|
-
};
|
2186
|
-
}
|
2187
|
-
webhookFromRaw(webhook) {
|
2188
|
-
return {
|
2189
|
-
id: webhook.id,
|
2190
|
-
type: webhook.type,
|
2191
|
-
guildID: webhook.guild_id,
|
2192
|
-
channelID: webhook.channel_id,
|
2193
|
-
user: webhook.user !== undefined ? this.userFromRaw(webhook.user) : undefined,
|
2194
|
-
name: webhook.name,
|
2195
|
-
avatar: webhook.avatar,
|
2196
|
-
token: webhook.token,
|
2197
|
-
applicationID: webhook.application_id,
|
2198
|
-
sourceGuild: webhook.source_guild !== undefined
|
2199
|
-
? this.guildFromRaw(webhook.source_guild)
|
2200
|
-
: undefined,
|
2201
|
-
sourceChannel: webhook.source_channel !== undefined
|
2202
|
-
? this.channelFromRaw(webhook.source_channel)
|
2203
|
-
: undefined,
|
2204
|
-
url: webhook.url,
|
2205
|
-
};
|
2206
|
-
}
|
2207
|
-
webhookToRaw(webhook) {
|
2208
|
-
return {
|
2209
|
-
id: webhook.id,
|
2210
|
-
type: webhook.type,
|
2211
|
-
guild_id: webhook.guildID,
|
2212
|
-
channel_id: webhook.channelID,
|
2213
|
-
user: webhook.user !== undefined ? this.userToRaw(webhook.user) : undefined,
|
2214
|
-
name: webhook.name,
|
2215
|
-
avatar: webhook.avatar,
|
2216
|
-
token: webhook.token,
|
2217
|
-
application_id: webhook.applicationID,
|
2218
|
-
source_guild: webhook.sourceGuild !== undefined
|
2219
|
-
? this.guildToRaw(webhook.sourceGuild)
|
2220
|
-
: undefined,
|
2221
|
-
source_channel: webhook.sourceChannel !== undefined
|
2222
|
-
? this.channelToRaw(webhook.sourceChannel)
|
2223
|
-
: undefined,
|
2224
|
-
url: webhook.url,
|
2225
|
-
};
|
2226
|
-
}
|
2227
|
-
}
|
2228
|
-
exports.Util = Util;
|