disgroove 2.2.2-dev.4aafdf4 → 2.2.2-dev.bd3875c

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.
@@ -3,182 +3,114 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Util = void 0;
4
4
  const constants_1 = require("../constants");
5
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) {
6
+ applicationCommandFromRaw(applicationCommand) {
91
7
  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
- },
8
+ id: applicationCommand.id,
9
+ type: applicationCommand.type,
10
+ applicationID: applicationCommand.application_id,
11
+ guildID: applicationCommand.guild_id,
12
+ name: applicationCommand.name,
13
+ nameLocalizations: applicationCommand.name_localizations,
14
+ description: applicationCommand.description,
15
+ descriptionLocalizations: applicationCommand.description_localizations,
16
+ options: applicationCommand.options?.map((option) => ({
17
+ type: option.type,
18
+ name: option.name,
19
+ name_localizations: option.name_localizations,
20
+ description: option.description,
21
+ description_localizations: option.description_localizations,
22
+ required: option.required,
23
+ choices: option.choices?.map((choice) => ({
24
+ name: choice.name,
25
+ name_localizations: choice.name_localizations,
26
+ value: choice.value,
27
+ })),
28
+ options: option.options?.map((o) => ({
29
+ type: o.type,
30
+ name: o.name,
31
+ name_localizations: o.name_localizations,
32
+ description: o.description,
33
+ description_localizations: o.description_localizations,
34
+ required: o.required,
35
+ choices: o.choices?.map((choice) => ({
36
+ name: choice.name,
37
+ name_localizations: choice.name_localizations,
38
+ value: choice.value,
39
+ })),
40
+ channel_types: o.channel_types,
41
+ min_value: o.min_value,
42
+ max_value: o.max_value,
43
+ min_length: o.min_length,
44
+ max_length: o.max_length,
45
+ autocomplete: o.autocomplete,
46
+ })),
47
+ channel_types: option.channel_types,
48
+ min_value: option.min_value,
49
+ max_value: option.max_value,
50
+ min_length: option.min_length,
51
+ max_length: option.max_length,
52
+ autocomplete: option.autocomplete,
113
53
  })),
114
- enabled: autoModerationRule.enabled,
115
- exemptRoles: autoModerationRule.exempt_roles,
116
- exemptChannels: autoModerationRule.exempt_channels,
54
+ defaultMemberPermissions: applicationCommand.default_member_permissions,
55
+ dmPermission: applicationCommand.dm_permission,
56
+ defaultPermission: applicationCommand.default_permission,
57
+ nsfw: applicationCommand.nsfw,
58
+ version: applicationCommand.version,
117
59
  };
118
60
  }
119
- autoModerationRuleToRaw(autoModerationRule) {
61
+ applicationCommandToRaw(applicationCommand) {
120
62
  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
- },
63
+ id: applicationCommand.id,
64
+ type: applicationCommand.type,
65
+ application_id: applicationCommand.applicationID,
66
+ guild_id: applicationCommand.guildID,
67
+ name: applicationCommand.name,
68
+ name_localizations: applicationCommand.nameLocalizations,
69
+ description: applicationCommand.description,
70
+ description_localizations: applicationCommand.descriptionLocalizations,
71
+ options: applicationCommand.options?.map((option) => ({
72
+ type: option.type,
73
+ name: option.name,
74
+ name_localizations: option.nameLocalizations,
75
+ description: option.description,
76
+ description_localizations: option.descriptionLocalizations,
77
+ required: option.required,
78
+ choices: option.choices?.map((choice) => ({
79
+ name: choice.name,
80
+ name_localizations: choice.nameLocalizations,
81
+ value: choice.value,
82
+ })),
83
+ options: option.options?.map((o) => ({
84
+ type: o.type,
85
+ name: o.name,
86
+ name_localizations: o.nameLocalizations,
87
+ description: o.description,
88
+ description_localizations: o.descriptionLocalizations,
89
+ required: o.required,
90
+ choices: o.choices?.map((choice) => ({
91
+ name: choice.name,
92
+ name_localizations: choice.nameLocalizations,
93
+ value: choice.value,
94
+ })),
95
+ channel_types: o.channelTypes,
96
+ min_value: o.minValue,
97
+ max_value: o.maxValue,
98
+ min_length: o.minLength,
99
+ max_length: o.maxLength,
100
+ autocomplete: o.autocomplete,
101
+ })),
102
+ channel_types: option.channelTypes,
103
+ min_value: option.minValue,
104
+ max_value: option.maxValue,
105
+ min_length: option.minLength,
106
+ max_length: option.maxLength,
107
+ autocomplete: option.autocomplete,
142
108
  })),
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,
109
+ default_member_permissions: applicationCommand.defaultMemberPermissions,
110
+ dm_permission: applicationCommand.dmPermission,
111
+ default_permission: applicationCommand.defaultPermission,
112
+ nsfw: applicationCommand.nsfw,
113
+ version: applicationCommand.version,
182
114
  };
183
115
  }
184
116
  applicationFromRaw(application) {
@@ -269,114 +201,182 @@ class Util {
269
201
  custom_install_url: application.customInstallURL,
270
202
  };
271
203
  }
272
- applicationCommandFromRaw(applicationCommand) {
204
+ attachmentFromRaw(attachment) {
205
+ return {
206
+ id: attachment.id,
207
+ filename: attachment.filename,
208
+ title: attachment.title,
209
+ description: attachment.description,
210
+ contentType: attachment.content_type,
211
+ size: attachment.size,
212
+ url: attachment.url,
213
+ proxyURL: attachment.proxy_url,
214
+ height: attachment.height,
215
+ width: attachment.width,
216
+ ephemeral: attachment.ephemeral,
217
+ durationSecs: attachment.duration_secs,
218
+ waveform: attachment.waveform,
219
+ flags: attachment.flags,
220
+ };
221
+ }
222
+ attachmentToRaw(attachment) {
223
+ return {
224
+ id: attachment.id,
225
+ filename: attachment.filename,
226
+ title: attachment.title,
227
+ description: attachment.description,
228
+ content_type: attachment.contentType,
229
+ size: attachment.size,
230
+ url: attachment.url,
231
+ proxy_url: attachment.proxyURL,
232
+ height: attachment.height,
233
+ width: attachment.width,
234
+ ephemeral: attachment.ephemeral,
235
+ duration_secs: attachment.durationSecs,
236
+ waveform: attachment.waveform,
237
+ flags: attachment.flags,
238
+ };
239
+ }
240
+ auditLogEntryFromRaw(auditLogEntry) {
241
+ return {
242
+ targetID: auditLogEntry.target_id,
243
+ changes: auditLogEntry.changes?.map((auditLogChange) => ({
244
+ newValue: auditLogChange.new_value,
245
+ oldValue: auditLogChange.old_value,
246
+ key: auditLogChange.key,
247
+ })),
248
+ userID: auditLogEntry.user_id,
249
+ id: auditLogEntry.id,
250
+ actionType: auditLogEntry.action_type,
251
+ options: auditLogEntry.options !== undefined
252
+ ? {
253
+ applicationID: auditLogEntry.options.application_id,
254
+ autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
255
+ autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
256
+ channelID: auditLogEntry.options.channel_id,
257
+ count: auditLogEntry.options.count,
258
+ deleteMemberDays: auditLogEntry.options.delete_member_days,
259
+ id: auditLogEntry.options.id,
260
+ membersRemoved: auditLogEntry.options.members_removed,
261
+ messageID: auditLogEntry.options.message_id,
262
+ roleName: auditLogEntry.options.role_name,
263
+ type: auditLogEntry.options.type,
264
+ integrationType: auditLogEntry.options.integration_type,
265
+ }
266
+ : undefined,
267
+ reason: auditLogEntry.reason,
268
+ };
269
+ }
270
+ auditLogEntryToRaw(auditLogEntry) {
271
+ return {
272
+ target_id: auditLogEntry.targetID,
273
+ changes: auditLogEntry.changes?.map((auditLogChange) => ({
274
+ new_value: auditLogChange.newValue,
275
+ old_value: auditLogChange.oldValue,
276
+ key: auditLogChange.key,
277
+ })),
278
+ user_id: auditLogEntry.userID,
279
+ id: auditLogEntry.id,
280
+ action_type: auditLogEntry.actionType,
281
+ options: auditLogEntry.options !== undefined
282
+ ? {
283
+ application_id: auditLogEntry.options.applicationID,
284
+ auto_moderation_rule_name: auditLogEntry.options.autoModerationRuleName,
285
+ auto_moderation_rule_trigger_type: auditLogEntry.options.autoModerationRuleTriggerType,
286
+ channel_id: auditLogEntry.options.channelID,
287
+ count: auditLogEntry.options.count,
288
+ delete_member_days: auditLogEntry.options.deleteMemberDays,
289
+ id: auditLogEntry.options.id,
290
+ members_removed: auditLogEntry.options.membersRemoved,
291
+ message_id: auditLogEntry.options.messageID,
292
+ role_name: auditLogEntry.options.roleName,
293
+ type: auditLogEntry.options.type,
294
+ integration_type: auditLogEntry.options.integrationType,
295
+ }
296
+ : undefined,
297
+ reason: auditLogEntry.reason,
298
+ };
299
+ }
300
+ auditLogFromRaw(auditLog) {
301
+ return {
302
+ applicationCommands: auditLog.application_commands.map((applicationCommand) => this.applicationCommandFromRaw(applicationCommand)),
303
+ auditLogEntries: auditLog.audit_log_entries.map((auditLogEntry) => this.auditLogEntryFromRaw(auditLogEntry)),
304
+ autoModerationRules: auditLog.auto_moderation_rules.map((autoModerationRule) => this.autoModerationRuleFromRaw(autoModerationRule)),
305
+ guildScheduledEvents: auditLog.guild_scheduled_events.map((guildScheduledEvent) => this.guildScheduledEventFromRaw(guildScheduledEvent)),
306
+ integrations: auditLog.integrations.map((integration) => this.integrationFromRaw(integration)),
307
+ threads: auditLog.threads.map((thread) => this.channelFromRaw(thread)),
308
+ users: auditLog.users.map((user) => this.userFromRaw(user)),
309
+ webhooks: auditLog.webhooks.map((webhook) => this.webhookFromRaw(webhook)),
310
+ };
311
+ }
312
+ auditLogToRaw(auditLog) {
313
+ return {
314
+ application_commands: auditLog.applicationCommands.map((applicationCommand) => this.applicationCommandToRaw(applicationCommand)),
315
+ audit_log_entries: auditLog.auditLogEntries.map((auditLogEntry) => this.auditLogEntryToRaw(auditLogEntry)),
316
+ auto_moderation_rules: auditLog.autoModerationRules.map((autoModerationRule) => this.autoModerationRuleToRaw(autoModerationRule)),
317
+ guild_scheduled_events: auditLog.guildScheduledEvents.map((guildScheduledEvent) => this.guildScheduledEventToRaw(guildScheduledEvent)),
318
+ integrations: auditLog.integrations.map((integration) => this.integrationToRaw(integration)),
319
+ threads: auditLog.threads.map((thread) => this.channelToRaw(thread)),
320
+ users: auditLog.users.map((user) => this.userToRaw(user)),
321
+ webhooks: auditLog.webhooks.map((webhook) => this.webhookToRaw(webhook)),
322
+ };
323
+ }
324
+ autoModerationRuleFromRaw(autoModerationRule) {
273
325
  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,
326
+ id: autoModerationRule.id,
327
+ guildID: autoModerationRule.guild_id,
328
+ name: autoModerationRule.name,
329
+ creatorID: autoModerationRule.creator_id,
330
+ eventType: autoModerationRule.event_type,
331
+ triggerType: autoModerationRule.trigger_type,
332
+ triggerMetadata: {
333
+ keywordFilter: autoModerationRule.trigger_metadata.keyword_filter,
334
+ regexPatterns: autoModerationRule.trigger_metadata.regex_patterns,
335
+ presets: autoModerationRule.trigger_metadata.presets,
336
+ allowList: autoModerationRule.trigger_metadata.allow_list,
337
+ mentionTotalLimit: autoModerationRule.trigger_metadata.mention_total_limit,
338
+ mentionRaidProtection: autoModerationRule.trigger_metadata.mention_raid_protection,
339
+ },
340
+ actions: autoModerationRule.actions.map((action) => ({
341
+ type: action.type,
342
+ metadata: {
343
+ channelID: action.metadata.channel_id,
344
+ durationSeconds: action.metadata.duration_seconds,
345
+ customMessage: action.metadata.custom_message,
346
+ },
319
347
  })),
320
- defaultMemberPermissions: applicationCommand.default_member_permissions,
321
- dmPermission: applicationCommand.dm_permission,
322
- defaultPermission: applicationCommand.default_permission,
323
- nsfw: applicationCommand.nsfw,
324
- version: applicationCommand.version,
348
+ enabled: autoModerationRule.enabled,
349
+ exemptRoles: autoModerationRule.exempt_roles,
350
+ exemptChannels: autoModerationRule.exempt_channels,
325
351
  };
326
352
  }
327
- applicationCommandToRaw(applicationCommand) {
353
+ autoModerationRuleToRaw(autoModerationRule) {
328
354
  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,
355
+ id: autoModerationRule.id,
356
+ guild_id: autoModerationRule.guildID,
357
+ name: autoModerationRule.name,
358
+ creator_id: autoModerationRule.creatorID,
359
+ event_type: autoModerationRule.eventType,
360
+ trigger_type: autoModerationRule.triggerType,
361
+ trigger_metadata: {
362
+ keyword_filter: autoModerationRule.triggerMetadata.keywordFilter,
363
+ regex_patterns: autoModerationRule.triggerMetadata.regexPatterns,
364
+ presets: autoModerationRule.triggerMetadata.presets,
365
+ allow_list: autoModerationRule.triggerMetadata.allowList,
366
+ mention_total_limit: autoModerationRule.triggerMetadata.mentionTotalLimit,
367
+ mention_raid_protection: autoModerationRule.triggerMetadata.mentionRaidProtection,
368
+ },
369
+ actions: autoModerationRule.actions.map((action) => ({
370
+ type: action.type,
371
+ metadata: {
372
+ channel_id: action.metadata.channelID,
373
+ duration_seconds: action.metadata.durationSeconds,
374
+ custom_message: action.metadata.customMessage,
375
+ },
374
376
  })),
375
- default_member_permissions: applicationCommand.defaultMemberPermissions,
376
- dm_permission: applicationCommand.dmPermission,
377
- default_permission: applicationCommand.defaultPermission,
378
- nsfw: applicationCommand.nsfw,
379
- version: applicationCommand.version,
377
+ enabled: autoModerationRule.enabled,
378
+ exempt_roles: autoModerationRule.exemptRoles,
379
+ exempt_channels: autoModerationRule.exemptChannels,
380
380
  };
381
381
  }
382
382
  channelFromRaw(channel) {
@@ -812,63 +812,6 @@ class Util {
812
812
  safetyAlertsChannelID: guild.safety_alerts_channel_id,
813
813
  };
814
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
815
  guildMemberFromRaw(guildMember) {
873
816
  return {
874
817
  user: guildMember.user !== undefined
@@ -979,6 +922,63 @@ class Util {
979
922
  is_dirty: guildTemplate.isDirty,
980
923
  };
981
924
  }
925
+ guildToRaw(guild) {
926
+ return {
927
+ id: guild.id,
928
+ name: guild.name,
929
+ icon: guild.icon,
930
+ icon_hash: guild.icon,
931
+ splash: guild.splash,
932
+ discovery_splash: guild.discoverySplash,
933
+ owner: guild.owner,
934
+ owner_id: guild.ownerID,
935
+ permissions: guild.permissions,
936
+ region: guild.region,
937
+ afk_channel_id: guild.afkChannelID,
938
+ afk_timeout: guild.afkTimeout,
939
+ widget_enabled: guild.widgetEnabled,
940
+ widget_channel_id: guild.widgetChannelID,
941
+ verification_level: guild.verificationLevel,
942
+ default_message_notifications: guild.defaultMessageNotifications,
943
+ explicit_content_filter: guild.explicitContentFilter,
944
+ roles: guild.roles.map((role) => this.roleToRaw(role)),
945
+ emojis: guild.emojis.map((emoji) => this.emojiToRaw(emoji)),
946
+ features: guild.features,
947
+ mfa_level: guild.mfaLevel,
948
+ application_id: guild.applicationID,
949
+ system_channel_id: guild.systemChannelID,
950
+ system_channel_flags: guild.systemChannelFlags,
951
+ rules_channel_id: guild.rulesChannelID,
952
+ max_presences: guild.maxPresences,
953
+ max_members: guild.maxMembers,
954
+ vanity_url_code: guild.vanityURLCode,
955
+ description: guild.description,
956
+ banner: guild.banner,
957
+ premium_tier: guild.premiumTier,
958
+ premium_subscription_count: guild.premiumSubscriptionCount,
959
+ preferred_locale: guild.preferredLocale,
960
+ public_updates_channel_id: guild.publicUpdatesChannelID,
961
+ max_video_channel_users: guild.maxVideoChannelUsers,
962
+ max_stage_video_channel_users: guild.maxStageVideoChannelUsers,
963
+ approximate_member_count: guild.approximateMemberCount,
964
+ approximate_presence_count: guild.approximatePresenceCount,
965
+ welcome_screen: guild.welcomeScreen !== undefined
966
+ ? {
967
+ description: guild.welcomeScreen.description,
968
+ welcome_channels: guild.welcomeScreen.welcomeChannels.map((welcomeScreenChannel) => ({
969
+ channel_id: welcomeScreenChannel.channelID,
970
+ description: welcomeScreenChannel.description,
971
+ emoji_id: welcomeScreenChannel.emojiID,
972
+ emoji_name: welcomeScreenChannel.emojiName,
973
+ })),
974
+ }
975
+ : undefined,
976
+ nsfw_level: guild.nsfwLevel,
977
+ stickers: guild.stickers?.map((sticker) => this.stickerToRaw(sticker)),
978
+ premium_progress_bar_enabled: guild.premiumProgressBarEnabled,
979
+ safety_alerts_channel_id: guild.safetyAlertsChannelID,
980
+ };
981
+ }
982
982
  integrationFromRaw(integration) {
983
983
  return {
984
984
  id: integration.id,
@@ -1112,6 +1112,38 @@ class Util {
1112
1112
  context: interaction.context,
1113
1113
  };
1114
1114
  }
1115
+ interactionMetadataFromRaw(interactionMetadata) {
1116
+ return {
1117
+ id: interactionMetadata.id,
1118
+ type: interactionMetadata.type,
1119
+ user: this.userFromRaw(interactionMetadata.user),
1120
+ authorizingIntegrationOwners: {
1121
+ "0": interactionMetadata.authorizing_integration_owners[0],
1122
+ "1": interactionMetadata.authorizing_integration_owners[1],
1123
+ },
1124
+ originalResponseMessageID: interactionMetadata.original_response_message_id,
1125
+ interactedMessageID: interactionMetadata.interacted_message_id,
1126
+ triggeringInteractionMetadata: interactionMetadata.triggering_interaction_metadata !== undefined
1127
+ ? this.interactionMetadataFromRaw(interactionMetadata.triggering_interaction_metadata)
1128
+ : undefined,
1129
+ };
1130
+ }
1131
+ interactionMetadataToRaw(interactionMetadata) {
1132
+ return {
1133
+ id: interactionMetadata.id,
1134
+ type: interactionMetadata.type,
1135
+ user: this.userToRaw(interactionMetadata.user),
1136
+ authorizing_integration_owners: {
1137
+ "0": interactionMetadata.authorizingIntegrationOwners[0],
1138
+ "1": interactionMetadata.authorizingIntegrationOwners[1],
1139
+ },
1140
+ original_response_message_id: interactionMetadata.originalResponseMessageID,
1141
+ interacted_message_id: interactionMetadata.interactedMessageID,
1142
+ triggering_interaction_metadata: interactionMetadata.triggeringInteractionMetadata !== undefined
1143
+ ? this.interactionMetadataToRaw(interactionMetadata.triggeringInteractionMetadata)
1144
+ : undefined,
1145
+ };
1146
+ }
1115
1147
  interactionToRaw(interaction) {
1116
1148
  return {
1117
1149
  id: interaction.id,
@@ -1181,38 +1213,6 @@ class Util {
1181
1213
  context: interaction.context,
1182
1214
  };
1183
1215
  }
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
1216
  inviteFromRaw(invite) {
1217
1217
  return {
1218
1218
  type: invite.type,
@@ -1698,7 +1698,7 @@ class Util {
1698
1698
  }
1699
1699
  presenceFromRaw(presence) {
1700
1700
  return {
1701
- user: this.userFromRaw(presence.user),
1701
+ user: this.presenceUserFromRaw(presence.user),
1702
1702
  guildID: presence.guild_id,
1703
1703
  status: presence.status,
1704
1704
  activities: presence.activities.map((activity) => ({
@@ -1710,6 +1710,7 @@ class Util {
1710
1710
  applicationID: activity.application_id,
1711
1711
  details: activity.details,
1712
1712
  state: activity.state,
1713
+ emoji: activity.emoji,
1713
1714
  party: activity.party,
1714
1715
  assets: {
1715
1716
  largeImage: activity.assets?.large_image,
@@ -1727,7 +1728,7 @@ class Util {
1727
1728
  }
1728
1729
  presenceToRaw(presence) {
1729
1730
  return {
1730
- user: this.userToRaw(presence.user),
1731
+ user: this.presenceUserToRaw(presence.user),
1731
1732
  guild_id: presence.guildID,
1732
1733
  status: presence.status,
1733
1734
  activities: presence.activities.map((activity) => ({
@@ -1739,6 +1740,7 @@ class Util {
1739
1740
  application_id: activity.applicationID,
1740
1741
  details: activity.details,
1741
1742
  state: activity.state,
1743
+ emoji: activity.emoji,
1742
1744
  party: activity.party,
1743
1745
  assets: {
1744
1746
  large_image: activity.assets?.largeImage,
@@ -1754,6 +1756,92 @@ class Util {
1754
1756
  client_status: presence.clientStatus,
1755
1757
  };
1756
1758
  }
1759
+ presenceUserFromRaw(user) {
1760
+ return {
1761
+ id: user.id,
1762
+ username: user.username,
1763
+ discriminator: user.discriminator,
1764
+ globalName: user.global_name,
1765
+ avatar: user.avatar,
1766
+ bot: user.bot,
1767
+ system: user.system,
1768
+ mfaEnabled: user.mfa_enabled,
1769
+ banner: user.banner,
1770
+ accentColor: user.accent_color,
1771
+ locale: user.locale,
1772
+ verified: user.verified,
1773
+ email: user.email,
1774
+ flags: user.flags,
1775
+ premiumType: user.premium_type,
1776
+ publicFlags: user.public_flags,
1777
+ avatarDecoration: user.avatar_decoration,
1778
+ };
1779
+ }
1780
+ presenceUserToRaw(user) {
1781
+ return {
1782
+ id: user.id,
1783
+ username: user.username,
1784
+ discriminator: user.discriminator,
1785
+ global_name: user.globalName,
1786
+ avatar: user.avatar,
1787
+ bot: user.bot,
1788
+ system: user.system,
1789
+ mfa_enabled: user.mfaEnabled,
1790
+ banner: user.banner,
1791
+ accent_color: user.accentColor,
1792
+ locale: user.locale,
1793
+ verified: user.verified,
1794
+ email: user.email,
1795
+ flags: user.flags,
1796
+ premium_type: user.premiumType,
1797
+ public_flags: user.publicFlags,
1798
+ avatar_decoration: user.avatarDecoration,
1799
+ };
1800
+ }
1801
+ pollFromRaw(poll) {
1802
+ return {
1803
+ question: poll.question,
1804
+ answers: poll.answers.map((answer) => ({
1805
+ answerID: answer.answer_id,
1806
+ pollMedia: answer.poll_media,
1807
+ })),
1808
+ expiry: poll.expiry,
1809
+ allowMultiselect: poll.allow_multiselect,
1810
+ layoutType: poll.layout_type,
1811
+ results: poll.results !== undefined
1812
+ ? {
1813
+ isFinalized: poll.results.is_finalized,
1814
+ answerCounts: poll.results.answer_counts.map((answerCount) => ({
1815
+ id: answerCount.id,
1816
+ count: answerCount.count,
1817
+ meVoted: answerCount.me_voted,
1818
+ })),
1819
+ }
1820
+ : undefined,
1821
+ };
1822
+ }
1823
+ pollToRaw(poll) {
1824
+ return {
1825
+ question: poll.question,
1826
+ answers: poll.answers.map((answer) => ({
1827
+ answer_id: answer.answerID,
1828
+ poll_media: answer.pollMedia,
1829
+ })),
1830
+ expiry: poll.expiry,
1831
+ allow_multiselect: poll.allowMultiselect,
1832
+ layout_type: poll.layoutType,
1833
+ results: poll.results !== undefined
1834
+ ? {
1835
+ is_finalized: poll.results.isFinalized,
1836
+ answer_counts: poll.results.answerCounts.map((answerCount) => ({
1837
+ id: answerCount.id,
1838
+ count: answerCount.count,
1839
+ me_voted: answerCount.meVoted,
1840
+ })),
1841
+ }
1842
+ : undefined,
1843
+ };
1844
+ }
1757
1845
  resolvedDataFromRaw(resolvedData) {
1758
1846
  let users = {};
1759
1847
  let members = {};
@@ -1846,50 +1934,6 @@ class Util {
1846
1934
  attachments,
1847
1935
  };
1848
1936
  }
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
1937
  roleFromRaw(role) {
1894
1938
  return {
1895
1939
  id: role.id,
@@ -2054,28 +2098,6 @@ class Util {
2054
2098
  owner_user_id: team.ownerUserID,
2055
2099
  };
2056
2100
  }
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
2101
  testEntitlementFromRaw(entitlement) {
2080
2102
  return {
2081
2103
  id: entitlement.id,
@@ -2104,6 +2126,28 @@ class Util {
2104
2126
  guild_id: entitlement.guildID,
2105
2127
  };
2106
2128
  }
2129
+ threadMemberFromRaw(threadMember) {
2130
+ return {
2131
+ id: threadMember.id,
2132
+ userID: threadMember.user_id,
2133
+ joinTimestamp: threadMember.join_timestamp,
2134
+ flags: threadMember.flags,
2135
+ member: threadMember.member !== undefined
2136
+ ? this.guildMemberFromRaw(threadMember.member)
2137
+ : undefined,
2138
+ };
2139
+ }
2140
+ threadMemberToRaw(threadMember) {
2141
+ return {
2142
+ id: threadMember.id,
2143
+ user_id: threadMember.userID,
2144
+ join_timestamp: threadMember.joinTimestamp,
2145
+ flags: threadMember.flags,
2146
+ member: threadMember.member !== undefined
2147
+ ? this.guildMemberToRaw(threadMember.member)
2148
+ : undefined,
2149
+ };
2150
+ }
2107
2151
  userFromRaw(user) {
2108
2152
  return {
2109
2153
  id: user.id,