disgroove 1.3.2 → 1.3.3-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/dist/lib/Client.d.ts +234 -0
  2. package/dist/lib/Client.js +256 -0
  3. package/dist/lib/Client.js.map +1 -0
  4. package/dist/lib/constants.d.ts +1084 -0
  5. package/dist/lib/constants.js +1163 -0
  6. package/dist/lib/constants.js.map +1 -0
  7. package/dist/lib/gateway/Shard.d.ts +25 -0
  8. package/dist/lib/gateway/Shard.js +522 -0
  9. package/dist/lib/gateway/Shard.js.map +1 -0
  10. package/dist/lib/gateway/ShardsManager.d.ts +5 -0
  11. package/dist/lib/gateway/ShardsManager.js +13 -0
  12. package/dist/lib/gateway/ShardsManager.js.map +1 -0
  13. package/dist/lib/gateway/index.d.ts +2 -0
  14. package/dist/lib/gateway/index.js +19 -0
  15. package/dist/lib/gateway/index.js.map +1 -0
  16. package/dist/lib/index.d.ts +7 -0
  17. package/dist/lib/index.js +24 -0
  18. package/dist/lib/index.js.map +1 -0
  19. package/dist/lib/rest/CDN.d.ts +21 -0
  20. package/dist/lib/rest/CDN.js +46 -0
  21. package/dist/lib/rest/CDN.js.map +1 -0
  22. package/dist/lib/rest/Endpoints.d.ts +94 -0
  23. package/dist/lib/rest/Endpoints.js +211 -0
  24. package/dist/lib/rest/Endpoints.js.map +1 -0
  25. package/dist/lib/rest/REST.d.ts +22 -0
  26. package/dist/lib/rest/REST.js +35 -0
  27. package/dist/lib/rest/REST.js.map +1 -0
  28. package/dist/lib/rest/RequestsManager.d.ts +17 -0
  29. package/dist/lib/rest/RequestsManager.js +124 -0
  30. package/dist/lib/rest/RequestsManager.js.map +1 -0
  31. package/dist/lib/rest/index.d.ts +4 -0
  32. package/dist/lib/rest/index.js +34 -0
  33. package/dist/lib/rest/index.js.map +1 -0
  34. package/dist/lib/structures/Application.d.ts +174 -0
  35. package/dist/lib/structures/Application.js +328 -0
  36. package/dist/lib/structures/Application.js.map +1 -0
  37. package/dist/lib/structures/ApplicationCommand.d.ts +45 -0
  38. package/dist/lib/structures/ApplicationCommand.js +127 -0
  39. package/dist/lib/structures/ApplicationCommand.js.map +1 -0
  40. package/dist/lib/structures/AuditLog.d.ts +20 -0
  41. package/dist/lib/structures/AuditLog.js +76 -0
  42. package/dist/lib/structures/AuditLog.js.map +1 -0
  43. package/dist/lib/structures/AutoModerationRule.d.ts +34 -0
  44. package/dist/lib/structures/AutoModerationRule.js +96 -0
  45. package/dist/lib/structures/AutoModerationRule.js.map +1 -0
  46. package/dist/lib/structures/Base.d.ts +17 -0
  47. package/dist/lib/structures/Base.js +31 -0
  48. package/dist/lib/structures/Base.js.map +1 -0
  49. package/dist/lib/structures/Channel.d.ts +253 -0
  50. package/dist/lib/structures/Channel.js +591 -0
  51. package/dist/lib/structures/Channel.js.map +1 -0
  52. package/dist/lib/structures/ClientApplication.d.ts +150 -0
  53. package/dist/lib/structures/ClientApplication.js +241 -0
  54. package/dist/lib/structures/ClientApplication.js.map +1 -0
  55. package/dist/lib/structures/Emoji.d.ts +28 -0
  56. package/dist/lib/structures/Emoji.js +79 -0
  57. package/dist/lib/structures/Emoji.js.map +1 -0
  58. package/dist/lib/structures/Entitlement.d.ts +24 -0
  59. package/dist/lib/structures/Entitlement.js +68 -0
  60. package/dist/lib/structures/Entitlement.js.map +1 -0
  61. package/dist/lib/structures/Guild.d.ts +462 -0
  62. package/dist/lib/structures/Guild.js +1095 -0
  63. package/dist/lib/structures/Guild.js.map +1 -0
  64. package/dist/lib/structures/GuildMember.d.ts +50 -0
  65. package/dist/lib/structures/GuildMember.js +149 -0
  66. package/dist/lib/structures/GuildMember.js.map +1 -0
  67. package/dist/lib/structures/GuildScheduledEvent.d.ts +49 -0
  68. package/dist/lib/structures/GuildScheduledEvent.js +118 -0
  69. package/dist/lib/structures/GuildScheduledEvent.js.map +1 -0
  70. package/dist/lib/structures/GuildTemplate.d.ts +32 -0
  71. package/dist/lib/structures/GuildTemplate.js +76 -0
  72. package/dist/lib/structures/GuildTemplate.js.map +1 -0
  73. package/dist/lib/structures/Integration.d.ts +30 -0
  74. package/dist/lib/structures/Integration.js +102 -0
  75. package/dist/lib/structures/Integration.js.map +1 -0
  76. package/dist/lib/structures/Interaction.d.ts +76 -0
  77. package/dist/lib/structures/Interaction.js +345 -0
  78. package/dist/lib/structures/Interaction.js.map +1 -0
  79. package/dist/lib/structures/Invite.d.ts +28 -0
  80. package/dist/lib/structures/Invite.js +86 -0
  81. package/dist/lib/structures/Invite.js.map +1 -0
  82. package/dist/lib/structures/Message.d.ts +84 -0
  83. package/dist/lib/structures/Message.js +300 -0
  84. package/dist/lib/structures/Message.js.map +1 -0
  85. package/dist/lib/structures/Role.d.ts +37 -0
  86. package/dist/lib/structures/Role.js +90 -0
  87. package/dist/lib/structures/Role.js.map +1 -0
  88. package/dist/lib/structures/SKU.d.ts +23 -0
  89. package/dist/lib/structures/SKU.js +63 -0
  90. package/dist/lib/structures/SKU.js.map +1 -0
  91. package/dist/lib/structures/StageInstance.d.ts +24 -0
  92. package/dist/lib/structures/StageInstance.js +57 -0
  93. package/dist/lib/structures/StageInstance.js.map +1 -0
  94. package/dist/lib/structures/Sticker.d.ts +31 -0
  95. package/dist/lib/structures/Sticker.js +86 -0
  96. package/dist/lib/structures/Sticker.js.map +1 -0
  97. package/dist/lib/structures/Team.d.ts +14 -0
  98. package/dist/lib/structures/Team.js +39 -0
  99. package/dist/lib/structures/Team.js.map +1 -0
  100. package/dist/lib/structures/TestEntitlement.d.ts +23 -0
  101. package/dist/lib/structures/TestEntitlement.js +61 -0
  102. package/dist/lib/structures/TestEntitlement.js.map +1 -0
  103. package/dist/lib/structures/UnavailableGuild.d.ts +11 -0
  104. package/dist/lib/structures/UnavailableGuild.js +25 -0
  105. package/dist/lib/structures/UnavailableGuild.js.map +1 -0
  106. package/dist/lib/structures/User.d.ts +63 -0
  107. package/dist/lib/structures/User.js +177 -0
  108. package/dist/lib/structures/User.js.map +1 -0
  109. package/dist/lib/structures/VoiceState.d.ts +26 -0
  110. package/dist/lib/structures/VoiceState.js +70 -0
  111. package/dist/lib/structures/VoiceState.js.map +1 -0
  112. package/dist/lib/structures/Webhook.d.ts +84 -0
  113. package/dist/lib/structures/Webhook.js +239 -0
  114. package/dist/lib/structures/Webhook.js.map +1 -0
  115. package/dist/lib/structures/index.d.ts +27 -0
  116. package/dist/lib/structures/index.js +44 -0
  117. package/dist/lib/structures/index.js.map +1 -0
  118. package/dist/lib/types/application-command.d.ts +102 -0
  119. package/dist/lib/types/application-command.js +3 -0
  120. package/dist/lib/types/application-command.js.map +1 -0
  121. package/dist/lib/types/application-role-connection-metadata.d.ts +18 -0
  122. package/dist/lib/types/application-role-connection-metadata.js +3 -0
  123. package/dist/lib/types/application-role-connection-metadata.js.map +1 -0
  124. package/dist/lib/types/application.d.ts +66 -0
  125. package/dist/lib/types/application.js +3 -0
  126. package/dist/lib/types/application.js.map +1 -0
  127. package/dist/lib/types/audit-log.d.ts +82 -0
  128. package/dist/lib/types/audit-log.js +3 -0
  129. package/dist/lib/types/audit-log.js.map +1 -0
  130. package/dist/lib/types/auto-moderation.d.ts +65 -0
  131. package/dist/lib/types/auto-moderation.js +3 -0
  132. package/dist/lib/types/auto-moderation.js.map +1 -0
  133. package/dist/lib/types/channel.d.ts +456 -0
  134. package/dist/lib/types/channel.js +3 -0
  135. package/dist/lib/types/channel.js.map +1 -0
  136. package/dist/lib/types/emoji.d.ts +22 -0
  137. package/dist/lib/types/emoji.js +3 -0
  138. package/dist/lib/types/emoji.js.map +1 -0
  139. package/dist/lib/types/entitlements.d.ts +32 -0
  140. package/dist/lib/types/entitlements.js +3 -0
  141. package/dist/lib/types/entitlements.js.map +1 -0
  142. package/dist/lib/types/gateway-events.d.ts +805 -0
  143. package/dist/lib/types/gateway-events.js +3 -0
  144. package/dist/lib/types/gateway-events.js.map +1 -0
  145. package/dist/lib/types/guild-scheduled-event.d.ts +57 -0
  146. package/dist/lib/types/guild-scheduled-event.js +3 -0
  147. package/dist/lib/types/guild-scheduled-event.js.map +1 -0
  148. package/dist/lib/types/guild-template.d.ts +28 -0
  149. package/dist/lib/types/guild-template.js +3 -0
  150. package/dist/lib/types/guild-template.js.map +1 -0
  151. package/dist/lib/types/guild.d.ts +333 -0
  152. package/dist/lib/types/guild.js +3 -0
  153. package/dist/lib/types/guild.js.map +1 -0
  154. package/dist/lib/types/index.d.ts +23 -0
  155. package/dist/lib/types/index.js +40 -0
  156. package/dist/lib/types/index.js.map +1 -0
  157. package/dist/lib/types/interaction.d.ts +170 -0
  158. package/dist/lib/types/interaction.js +3 -0
  159. package/dist/lib/types/interaction.js.map +1 -0
  160. package/dist/lib/types/invite.d.ts +59 -0
  161. package/dist/lib/types/invite.js +3 -0
  162. package/dist/lib/types/invite.js.map +1 -0
  163. package/dist/lib/types/message-components.d.ts +100 -0
  164. package/dist/lib/types/message-components.js +3 -0
  165. package/dist/lib/types/message-components.js.map +1 -0
  166. package/dist/lib/types/role.d.ts +47 -0
  167. package/dist/lib/types/role.js +3 -0
  168. package/dist/lib/types/role.js.map +1 -0
  169. package/dist/lib/types/sku.d.ts +30 -0
  170. package/dist/lib/types/sku.js +3 -0
  171. package/dist/lib/types/sku.js.map +1 -0
  172. package/dist/lib/types/stage-instance.d.ts +20 -0
  173. package/dist/lib/types/stage-instance.js +3 -0
  174. package/dist/lib/types/stage-instance.js.map +1 -0
  175. package/dist/lib/types/sticker.d.ts +61 -0
  176. package/dist/lib/types/sticker.js +3 -0
  177. package/dist/lib/types/sticker.js.map +1 -0
  178. package/dist/lib/types/team.d.ts +30 -0
  179. package/dist/lib/types/team.js +3 -0
  180. package/dist/lib/types/team.js.map +1 -0
  181. package/dist/lib/types/user.d.ts +77 -0
  182. package/dist/lib/types/user.js +3 -0
  183. package/dist/lib/types/user.js.map +1 -0
  184. package/dist/lib/types/voice.d.ts +47 -0
  185. package/dist/lib/types/voice.js +3 -0
  186. package/dist/lib/types/voice.js.map +1 -0
  187. package/dist/lib/types/webhook.d.ts +31 -0
  188. package/dist/lib/types/webhook.js +3 -0
  189. package/dist/lib/types/webhook.js.map +1 -0
  190. package/dist/lib/utils/Util.d.ts +15 -0
  191. package/dist/lib/utils/Util.js +543 -0
  192. package/dist/lib/utils/Util.js.map +1 -0
  193. package/dist/lib/utils/errors.d.ts +12 -0
  194. package/dist/lib/utils/errors.js +25 -0
  195. package/dist/lib/utils/errors.js.map +1 -0
  196. package/dist/lib/utils/index.d.ts +2 -0
  197. package/dist/lib/utils/index.js +19 -0
  198. package/dist/lib/utils/index.js.map +1 -0
  199. package/dist/package.json +1 -1
  200. package/lib/Client.ts +616 -0
  201. package/lib/constants.ts +1173 -0
  202. package/lib/gateway/Shard.ts +704 -0
  203. package/lib/gateway/ShardsManager.ts +11 -0
  204. package/lib/gateway/index.ts +2 -0
  205. package/lib/index.ts +7 -0
  206. package/lib/rest/CDN.ts +56 -0
  207. package/lib/rest/Endpoints.ts +241 -0
  208. package/lib/rest/REST.ts +45 -0
  209. package/lib/rest/RequestsManager.ts +134 -0
  210. package/lib/rest/index.ts +4 -0
  211. package/lib/structures/Application.ts +599 -0
  212. package/lib/structures/ApplicationCommand.ts +187 -0
  213. package/lib/structures/AuditLog.ts +112 -0
  214. package/lib/structures/AutoModerationRule.ts +127 -0
  215. package/lib/structures/Base.ts +39 -0
  216. package/lib/structures/Channel.ts +921 -0
  217. package/lib/structures/ClientApplication.ts +515 -0
  218. package/lib/structures/Emoji.ts +95 -0
  219. package/lib/structures/Entitlement.ts +65 -0
  220. package/lib/structures/Guild.ts +1842 -0
  221. package/lib/structures/GuildMember.ts +193 -0
  222. package/lib/structures/GuildScheduledEvent.ts +164 -0
  223. package/lib/structures/GuildTemplate.ts +103 -0
  224. package/lib/structures/Integration.ts +136 -0
  225. package/lib/structures/Interaction.ts +506 -0
  226. package/lib/structures/Invite.ts +108 -0
  227. package/lib/structures/Message.ts +421 -0
  228. package/lib/structures/Role.ts +116 -0
  229. package/lib/structures/SKU.ts +63 -0
  230. package/lib/structures/StageInstance.ts +74 -0
  231. package/lib/structures/Sticker.ts +100 -0
  232. package/lib/structures/Team.ts +41 -0
  233. package/lib/structures/TestEntitlement.ts +78 -0
  234. package/lib/structures/UnavailableGuild.ts +27 -0
  235. package/lib/structures/User.ts +233 -0
  236. package/lib/structures/VoiceState.ts +72 -0
  237. package/lib/structures/Webhook.ts +341 -0
  238. package/lib/structures/index.ts +27 -0
  239. package/lib/types/application-command.ts +118 -0
  240. package/lib/types/application-role-connection-metadata.ts +23 -0
  241. package/lib/types/application.ts +77 -0
  242. package/lib/types/audit-log.ts +105 -0
  243. package/lib/types/auto-moderation.ts +78 -0
  244. package/lib/types/channel.ts +534 -0
  245. package/lib/types/emoji.ts +24 -0
  246. package/lib/types/entitlements.ts +34 -0
  247. package/lib/types/gateway-events.ts +970 -0
  248. package/lib/types/guild-scheduled-event.ts +67 -0
  249. package/lib/types/guild-template.ts +30 -0
  250. package/lib/types/guild.ts +388 -0
  251. package/lib/types/index.ts +23 -0
  252. package/lib/types/interaction.ts +224 -0
  253. package/lib/types/invite.ts +78 -0
  254. package/lib/types/message-components.ts +127 -0
  255. package/lib/types/role.ts +51 -0
  256. package/lib/types/sku.ts +32 -0
  257. package/lib/types/stage-instance.ts +22 -0
  258. package/lib/types/sticker.ts +67 -0
  259. package/lib/types/team.ts +34 -0
  260. package/lib/types/user.ts +93 -0
  261. package/lib/types/voice.ts +51 -0
  262. package/lib/types/webhook.ts +40 -0
  263. package/lib/utils/Util.ts +600 -0
  264. package/lib/utils/errors.ts +23 -0
  265. package/lib/utils/index.ts +2 -0
  266. package/package.json +1 -1
@@ -0,0 +1,328 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Application = void 0;
4
+ const _1 = require(".");
5
+ const rest_1 = require("../rest");
6
+ /** https://discord.com/developers/docs/resources/application */
7
+ class Application extends _1.Base {
8
+ raw;
9
+ name;
10
+ icon;
11
+ description;
12
+ rpcOrigins;
13
+ botPublic;
14
+ botRequireCodeGrant;
15
+ termsOfServiceURL;
16
+ privacyPolicyURL;
17
+ owner;
18
+ verifyKey;
19
+ team;
20
+ guildId;
21
+ guild;
22
+ primarySKUId;
23
+ slug;
24
+ coverImage;
25
+ flags;
26
+ approximateGuildCount;
27
+ redirectURIs;
28
+ interactionsEndpointURL;
29
+ roleConnectionsVerificationURL;
30
+ tags;
31
+ installParams;
32
+ customInstallURL;
33
+ constructor(data, client) {
34
+ super(data.id, client);
35
+ this.raw = data;
36
+ this.name = data.name;
37
+ this.icon = data.icon;
38
+ this.description = data.description;
39
+ this.botPublic = data.bot_public;
40
+ this.botRequireCodeGrant = data.bot_require_code_grant;
41
+ this.verifyKey = data.verify_key;
42
+ this.team = null;
43
+ this.patch(data);
44
+ }
45
+ patch(data) {
46
+ if (data.rpc_origins !== undefined)
47
+ this.rpcOrigins = data.rpc_origins;
48
+ if (data.terms_of_service_url !== undefined)
49
+ this.termsOfServiceURL = data.terms_of_service_url;
50
+ if (data.owner !== undefined)
51
+ this.owner = new _1.User(data.owner, this.client);
52
+ if (data.team !== undefined)
53
+ this.team = data.team !== null ? new _1.Team(data.team, this.client) : null;
54
+ if (data.guild_id !== undefined)
55
+ this.guildId = data.guild_id;
56
+ if (data.guild !== undefined)
57
+ this.guild = new _1.Guild(data.guild, this.client);
58
+ if (data.primary_sku_id !== undefined)
59
+ this.primarySKUId = data.primary_sku_id;
60
+ if (data.slug !== undefined)
61
+ this.slug = data.slug;
62
+ if (data.cover_image !== undefined)
63
+ this.coverImage = data.cover_image;
64
+ if (data.flags !== undefined)
65
+ this.flags = data.flags;
66
+ if (data.approximate_guild_count !== undefined)
67
+ this.approximateGuildCount = data.approximate_guild_count;
68
+ if (data.redirect_uris !== undefined)
69
+ this.redirectURIs = data.redirect_uris;
70
+ if (data.interactions_endpoint_url !== undefined)
71
+ this.interactionsEndpointURL = data.interactions_endpoint_url;
72
+ if (data.role_connections_verification_url !== undefined)
73
+ this.roleConnectionsVerificationURL =
74
+ data.role_connections_verification_url;
75
+ if (data.tags !== undefined)
76
+ this.tags = data.tags;
77
+ if (data.install_params !== undefined)
78
+ this.installParams = data.install_params;
79
+ if (data.custom_install_url !== undefined)
80
+ this.customInstallURL = data.custom_install_url;
81
+ }
82
+ /** https://discord.com/developers/docs/interactions/application-commands#create-global-application-command */
83
+ async createGlobalApplicationCommand(options) {
84
+ return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationCommands(this.id), {
85
+ json: this.client.util.applicationCommandToRaw(options),
86
+ }), this.client);
87
+ }
88
+ /** https://discord.com/developers/docs/interactions/application-commands#create-guild-application-command */
89
+ async createGuildApplicationCommand(guildId, options) {
90
+ return new _1.ApplicationCommand(await this.client.rest.post(rest_1.Endpoints.applicationGuildCommands(this.id, guildId), {
91
+ json: this.client.util.applicationCommandToRaw(options),
92
+ }), this.client);
93
+ }
94
+ /** https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement */
95
+ async createTestEntitlement(options) {
96
+ return new _1.TestEntitlement(await this.client.rest.post(rest_1.Endpoints.applicationEntitlements(this.id), {
97
+ json: {
98
+ sku_id: options.skuId,
99
+ owner_id: options.ownerId,
100
+ owner_type: options.ownerType,
101
+ },
102
+ }), this.client);
103
+ }
104
+ /** https://discord.com/developers/docs/interactions/application-commands#delete-global-application-command */
105
+ deleteGlobalApplicationCommand(commandId) {
106
+ this.client.rest.delete(rest_1.Endpoints.applicationCommand(this.id, commandId));
107
+ }
108
+ /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
109
+ deleteGuildApplicationCommand(guildId, commandId) {
110
+ this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(this.id, guildId, commandId));
111
+ }
112
+ /** https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement */
113
+ deleteTestEntitlement(entitlementId) {
114
+ this.client.rest.delete(rest_1.Endpoints.applicationEntitlement(this.id, entitlementId));
115
+ }
116
+ /** https://discord.com/developers/docs/resources/application#edit-current-application */
117
+ async edit(options) {
118
+ return new Application(await this.client.rest.patch(rest_1.Endpoints.applicationCurrentUser(), {
119
+ json: {
120
+ custom_install_url: options.customInstallURL,
121
+ description: options.description,
122
+ role_connections_verification_url: options.roleConnectionsVerificationURL,
123
+ install_params: options.installParams,
124
+ flags: options.flags,
125
+ icon: options.icon,
126
+ cover_image: options.coverImage,
127
+ interactions_endpoint_url: options.interactionsEndpointURL,
128
+ tags: options.tags,
129
+ },
130
+ }), this.client);
131
+ }
132
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
133
+ async editApplicationCommandPermissions(guildId, commandId, options) {
134
+ return this.client.rest
135
+ .put(rest_1.Endpoints.applicationCommandPermissions(this.id, guildId, commandId), {
136
+ json: {
137
+ permissions: options.permissions.map((option) => ({
138
+ id: option.id,
139
+ application_id: option.applicationId,
140
+ guild_id: option.guildId,
141
+ permissions: option.permissions.map((permission) => ({
142
+ id: permission.id,
143
+ type: permission.type,
144
+ permission: permission.permission,
145
+ })),
146
+ })),
147
+ },
148
+ })
149
+ .then((response) => ({
150
+ id: response.id,
151
+ applicationId: response.application_id,
152
+ guildId: response.guild_id,
153
+ permissions: response.permissions.map((permission) => ({
154
+ id: permission.id,
155
+ type: permission.type,
156
+ permission: permission.permission,
157
+ })),
158
+ }));
159
+ }
160
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
161
+ async editGlobalApplicationCommand(commandId, options) {
162
+ return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationCommand(this.id, commandId), {
163
+ json: this.client.util.applicationCommandToRaw(options),
164
+ }), this.client);
165
+ }
166
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command */
167
+ async editGuildApplicationCommand(guildId, commandId, options) {
168
+ return new _1.ApplicationCommand(await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(this.id, guildId, commandId), {
169
+ json: this.client.util.applicationCommandToRaw(options),
170
+ }), this.client);
171
+ }
172
+ /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
173
+ async getApplicationCommandPermissions(guildId, commandId) {
174
+ return this.client.rest
175
+ .get(rest_1.Endpoints.applicationCommandPermissions(this.id, guildId, commandId))
176
+ .then((response) => response.map((permissions) => ({
177
+ id: permissions.id,
178
+ applicationId: permissions.application_id,
179
+ guildId: permissions.guild_id,
180
+ permissions: permissions.permissions.map((permission) => ({
181
+ id: permission.id,
182
+ type: permission.type,
183
+ permission: permission.permission,
184
+ })),
185
+ })));
186
+ }
187
+ /** https://discord.com/developers/docs/monetization/entitlements#list-entitlements */
188
+ async getEntitlements(options) {
189
+ return this.client.rest
190
+ .get(rest_1.Endpoints.applicationEntitlements(this.id), {
191
+ query: {
192
+ user_id: options?.userId,
193
+ sku_ids: options?.skuIds,
194
+ before: options?.before,
195
+ after: options?.after,
196
+ limit: options?.limit,
197
+ guild_id: options?.guildId,
198
+ exclude_ended: options?.excludeEnded,
199
+ },
200
+ })
201
+ .then((response) => response.map((data) => new _1.Entitlement(data, this.client)));
202
+ }
203
+ /** https://discord.com/developers/docs/interactions/application-commands#get-global-application-command */
204
+ async getGlobalApplicationCommand(commandId) {
205
+ return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationCommand(this.id, commandId)), this.client);
206
+ }
207
+ /** https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */
208
+ async getGlobalApplicationCommands(options) {
209
+ return this.client.rest
210
+ .get(rest_1.Endpoints.applicationCommands(this.id), {
211
+ query: {
212
+ with_localizations: options.withLocalizations,
213
+ },
214
+ })
215
+ .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
216
+ }
217
+ /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command */
218
+ async getGuildApplicationCommand(guildId, commandId) {
219
+ return new _1.ApplicationCommand(await this.client.rest.get(rest_1.Endpoints.applicationGuildCommand(this.id, guildId, commandId)), this.client);
220
+ }
221
+ /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-commands */
222
+ async getGuildApplicationCommands(guildId, options) {
223
+ return this.client.rest
224
+ .get(rest_1.Endpoints.applicationGuildCommands(this.id, guildId), {
225
+ query: {
226
+ with_localizations: options?.withLocalizations,
227
+ },
228
+ })
229
+ .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
230
+ }
231
+ /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
232
+ async getGuildApplicationCommandPermissions(guildId) {
233
+ return this.client.rest
234
+ .get(rest_1.Endpoints.guildApplicationCommandsPermissions(this.id, guildId))
235
+ .then((response) => response.map((permissions) => ({
236
+ id: permissions.id,
237
+ applicationId: permissions.application_id,
238
+ guildId: permissions.guild_id,
239
+ permissions: permissions.permissions.map((permission) => ({
240
+ id: permission.id,
241
+ type: permission.type,
242
+ permission: permission.permission,
243
+ })),
244
+ })));
245
+ }
246
+ /** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
247
+ async getApplicationRoleConnectionMetadataRecords() {
248
+ return this.client.rest
249
+ .get(rest_1.Endpoints.applicationRoleConnectionMetadata(this.id))
250
+ .then((response) => response.map((data) => ({
251
+ type: data.type,
252
+ key: data.key,
253
+ name: data.name,
254
+ nameLocalizations: data.name_localizations,
255
+ description: data.description,
256
+ descriptionLocalizations: data.description_localizations,
257
+ })));
258
+ }
259
+ /** https://discord.com/developers/docs/monetization/skus#list-skus */
260
+ async getSKUs() {
261
+ return this.client.rest
262
+ .get(rest_1.Endpoints.applicationSKUs(this.id))
263
+ .then((response) => response.map((data) => new _1.SKU(data, this.client)));
264
+ }
265
+ /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands */
266
+ async setGlobalApplicationCommands(commands) {
267
+ return this.client.rest
268
+ .put(rest_1.Endpoints.applicationCommands(this.id), {
269
+ json: commands.map((command) => this.client.util.applicationCommandToRaw(command)),
270
+ })
271
+ .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
272
+ }
273
+ /** https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-guild-application-commands */
274
+ async setGuildApplicationCommands(guildId, commands) {
275
+ return this.client.rest
276
+ .put(rest_1.Endpoints.applicationGuildCommands(this.id, guildId), {
277
+ json: commands.map((command) => this.client.util.applicationCommandToRaw(command)),
278
+ })
279
+ .then((response) => response.map((data) => new _1.ApplicationCommand(data, this.client)));
280
+ }
281
+ /** https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */
282
+ async updateApplicationRoleConnectionMetadataRecords() {
283
+ return this.client.rest
284
+ .put(rest_1.Endpoints.applicationRoleConnectionMetadata(this.id))
285
+ .then((response) => response.map((data) => ({
286
+ type: data.type,
287
+ key: data.key,
288
+ name: data.name,
289
+ nameLocalizations: data.name_localizations,
290
+ description: data.description,
291
+ descriptionLocalizations: data.description_localizations,
292
+ })));
293
+ }
294
+ toRaw() {
295
+ return this.raw;
296
+ }
297
+ toJSON() {
298
+ return {
299
+ ...super.toJSON(),
300
+ name: this.name,
301
+ icon: this.icon,
302
+ description: this.description,
303
+ rpcOrigins: this.rpcOrigins,
304
+ botPublic: this.botPublic,
305
+ botRequireCodeGrant: this.botRequireCodeGrant,
306
+ termsOfServiceURL: this.termsOfServiceURL,
307
+ privacyPolicyURL: this.privacyPolicyURL,
308
+ owner: this.owner?.toJSON(),
309
+ verifyKey: this.verifyKey,
310
+ team: this.team?.toJSON() ?? null,
311
+ guildId: this.guildId,
312
+ guild: this.guild?.toJSON(),
313
+ primarySKUId: this.primarySKUId,
314
+ slug: this.slug,
315
+ coverImage: this.coverImage,
316
+ flags: this.flags,
317
+ approximateGuildCount: this.approximateGuildCount,
318
+ redirectURIs: this.redirectURIs,
319
+ interactionsEndpointURL: this.interactionsEndpointURL,
320
+ roleConnectionsVerificationURL: this.roleConnectionsVerificationURL,
321
+ tags: this.tags,
322
+ installParams: this.installParams,
323
+ customInstallURL: this.customInstallURL,
324
+ };
325
+ }
326
+ }
327
+ exports.Application = Application;
328
+ //# sourceMappingURL=Application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Application.js","sourceRoot":"","sources":["../../../lib/structures/Application.ts"],"names":[],"mappings":";;;AAAA,wBASW;AAeX,kCAAoC;AAOpC,gEAAgE;AAChE,MAAa,WAAY,SAAQ,OAAI;IAChB,GAAG,CAAiB;IACvC,IAAI,CAAS;IACb,IAAI,CAAgB;IACpB,WAAW,CAAS;IACpB,UAAU,CAAiB;IAC3B,SAAS,CAAU;IACnB,mBAAmB,CAAU;IAC7B,iBAAiB,CAAU;IAC3B,gBAAgB,CAAU;IAC1B,KAAK,CAAQ;IACb,SAAS,CAAS;IAClB,IAAI,CAAc;IAClB,OAAO,CAAU;IACjB,KAAK,CAAS;IACd,YAAY,CAAU;IACtB,IAAI,CAAU;IACd,UAAU,CAAU;IACpB,KAAK,CAAoB;IACzB,qBAAqB,CAAU;IAC/B,YAAY,CAAiB;IAC7B,uBAAuB,CAAU;IACjC,8BAA8B,CAAU;IACxC,IAAI,CAAiB;IACrB,aAAa,CAAqB;IAClC,gBAAgB,CAAU;IAE1B,YAAY,IAAoB,EAAE,MAAc;QAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;QAEvB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,CAAC;QACvD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAEkB,KAAK,C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AAI,CAAC,iBAAiB;YACzC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE;YAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,IAAI;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,qBAAqB,EAAE,IAAI,CAAC,qBAAqB;YACjD,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,uBAAuB,EAAE,IAAI,CAAC,uBAAuB;YACrD,8BAA8B,EAAE,IAAI,CAAC,8BAA8B;YACnE,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC,CAAC;IACJ,CAAC;CACF;AAtjBD,kCAsjBC"}
@@ -0,0 +1,45 @@
1
+ import type { Client } from "../Client";
2
+ import type { JSONApplicationCommand, JSONApplicationCommandOption, JSONApplicationCommandPermission, JSONGuildApplicationCommandPermissions, RawApplicationCommand } from "../types";
3
+ import type { ApplicationCommandTypes, Locale } from "../constants";
4
+ import { Base } from ".";
5
+ /** https://discord.com/developers/docs/interactions/application-commands */
6
+ export declare class ApplicationCommand extends Base {
7
+ protected raw: RawApplicationCommand;
8
+ type?: ApplicationCommandTypes;
9
+ applicationId: string;
10
+ guildId?: string;
11
+ name: string;
12
+ nameLocalizations?: Partial<Record<Locale, string>> | null;
13
+ description: string;
14
+ descriptionLocalizations?: Partial<Record<Locale, string>> | null;
15
+ options?: Array<JSONApplicationCommandOption>;
16
+ defaultMemberPermissions: string | null;
17
+ dmPermission?: boolean;
18
+ defaultPermission?: boolean | null;
19
+ nsfw?: boolean;
20
+ version: string;
21
+ constructor(data: RawApplicationCommand, client: Client);
22
+ protected patch(data: RawApplicationCommand): void;
23
+ /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
24
+ delete(): void;
25
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
26
+ edit(options: {
27
+ name?: string;
28
+ nameLocalizations?: Partial<Record<Locale, string>> | null;
29
+ description?: string;
30
+ descriptionLocalizations?: Partial<Record<Locale, string>> | null;
31
+ options?: Array<JSONApplicationCommandOption>;
32
+ defaultMemberPermissions?: string | null;
33
+ defaultPermission?: boolean | null;
34
+ dmPermission?: boolean;
35
+ nsfw?: boolean;
36
+ }): Promise<ApplicationCommand>;
37
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
38
+ editPermissions(options: {
39
+ permissions: Array<JSONApplicationCommandPermission>;
40
+ }): Promise<JSONGuildApplicationCommandPermissions>;
41
+ /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
42
+ getPermissions(): Promise<JSONGuildApplicationCommandPermissions>;
43
+ toRaw(): RawApplicationCommand;
44
+ toJSON(): JSONApplicationCommand;
45
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplicationCommand = void 0;
4
+ const rest_1 = require("../rest");
5
+ const _1 = require(".");
6
+ /** https://discord.com/developers/docs/interactions/application-commands */
7
+ class ApplicationCommand extends _1.Base {
8
+ raw;
9
+ type;
10
+ applicationId;
11
+ guildId;
12
+ name;
13
+ nameLocalizations;
14
+ description;
15
+ descriptionLocalizations;
16
+ options;
17
+ defaultMemberPermissions;
18
+ dmPermission;
19
+ defaultPermission;
20
+ nsfw;
21
+ version;
22
+ constructor(data, client) {
23
+ super(data.id, client);
24
+ this.raw = data;
25
+ this.applicationId = data.application_id;
26
+ this.name = data.name;
27
+ this.description = data.description;
28
+ this.defaultMemberPermissions = data.default_member_permissions;
29
+ this.version = data.version;
30
+ this.patch(data);
31
+ }
32
+ patch(data) {
33
+ if (data.type !== undefined)
34
+ this.type = data.type;
35
+ if (data.guild_id !== undefined)
36
+ this.guildId = data.guild_id;
37
+ if (data.name_localizations !== undefined)
38
+ this.nameLocalizations = data.name_localizations;
39
+ if (data.description_localizations !== undefined)
40
+ this.descriptionLocalizations = data.description_localizations;
41
+ if (data.options !== undefined)
42
+ this.options = data.options;
43
+ if (data.dm_permission !== undefined)
44
+ this.dmPermission = data.dm_permission;
45
+ if (data.default_permission !== undefined)
46
+ this.defaultPermission = data.default_permission;
47
+ if (data.nsfw !== undefined)
48
+ this.nsfw = data.nsfw;
49
+ }
50
+ /** https://discord.com/developers/docs/interactions/application-commands#delete-guild-application-command */
51
+ delete() {
52
+ this.guildId !== undefined
53
+ ? this.client.rest.delete(rest_1.Endpoints.applicationGuildCommand(this.applicationId, this.guildId, this.id))
54
+ : this.client.rest.delete(rest_1.Endpoints.applicationCommand(this.applicationId, this.id));
55
+ }
56
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
57
+ async edit(options) {
58
+ return new ApplicationCommand(this.guildId !== undefined
59
+ ? await this.client.rest.patch(rest_1.Endpoints.applicationGuildCommand(this.id, this.guildId, this.id), {
60
+ json: this.client.util.applicationCommandToRaw(options),
61
+ })
62
+ : await this.client.rest.patch(rest_1.Endpoints.applicationCommand(this.applicationId, this.id), {
63
+ json: this.client.util.applicationCommandToRaw(options),
64
+ }), this.client);
65
+ }
66
+ /** https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions */
67
+ async editPermissions(options) {
68
+ if (!this.guildId)
69
+ throw new Error("[disgroove] Cannot edit the permissions of a global application command");
70
+ return this.client.rest
71
+ .put(rest_1.Endpoints.applicationCommandPermissions(this.applicationId, this.guildId, this.id), {
72
+ json: {
73
+ permissions: options.permissions,
74
+ },
75
+ })
76
+ .then((response) => ({
77
+ id: response.id,
78
+ applicationId: response.application_id,
79
+ guildId: response.guild_id,
80
+ permissions: response.permissions.map((permission) => ({
81
+ id: permission.id,
82
+ type: permission.type,
83
+ permission: permission.permission,
84
+ })),
85
+ }));
86
+ }
87
+ /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
88
+ async getPermissions() {
89
+ if (!this.guildId)
90
+ throw new Error("[disgroove] Cannot get the permissions of a global application command");
91
+ return this.client.rest
92
+ .get(rest_1.Endpoints.applicationCommandPermissions(this.applicationId, this.guildId, this.id))
93
+ .then((response) => ({
94
+ id: response.id,
95
+ applicationId: response.application_id,
96
+ guildId: response.guild_id,
97
+ permissions: response.permissions.map((permission) => ({
98
+ id: permission.id,
99
+ type: permission.type,
100
+ permission: permission.permission,
101
+ })),
102
+ }));
103
+ }
104
+ toRaw() {
105
+ return this.raw;
106
+ }
107
+ toJSON() {
108
+ return {
109
+ ...super.toJSON(),
110
+ type: this.type,
111
+ applicationId: this.applicationId,
112
+ guildId: this.guildId,
113
+ name: this.name,
114
+ nameLocalizations: this.nameLocalizations,
115
+ description: this.description,
116
+ descriptionLocalizations: this.descriptionLocalizations,
117
+ options: this.options,
118
+ defaultMemberPermissions: this.defaultMemberPermissions,
119
+ dmPermission: this.dmPermission,
120
+ defaultPermission: this.defaultPermission,
121
+ nsfw: this.nsfw,
122
+ version: this.version,
123
+ };
124
+ }
125
+ }
126
+ exports.ApplicationCommand = ApplicationCommand;
127
+ //# sourceMappingURL=ApplicationCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApplicationCommand.js","sourceRoot":"","sources":["../../../lib/structures/ApplicationCommand.ts"],"names":[],"mappings":";;;AACA,kCAAoC;AAUpC,wBAAyB;AAEzB,4EAA4E;AAC5E,MAAa,kBAAmB,SAAQ,OAAI;IACvB,GAAG,CAAwB;IAC9C,IAAI,CAA2B;IAC/B,aAAa,CAAS;IACtB,OAAO,CAAU;IACjB,IAAI,CAAS;IACb,iBAAiB,CAA0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,CAAC,EAAE;YACf,aAAa,EAAE,QAAQ,CAAC,cAAc;YACtC,OAAO,EAAE,QAAQ,CAAC,QAAQ;YAC1B,WAAW,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;gBACrD,EAAE,EAAE,UAAU,CAAC,EAAE;gBACjB,IAAI,EAAE,UAAU,CAAC,IAAI;gBACrB,UAAU,EAAE,UAAU,CAAC,UAAU;aAClC,CAAC,CAAC;SACJ,CAAC,CAAC,CAAC;IACR,CAAC;IAEQ,KAAK;QACZ,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAEQ,MAAM;QACb,OAAO;YACL,GAAG,KAAK,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;YACvD,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,wBAAwB,EAAE,IAAI,CAAC,wBAAwB;YACvD,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;YACzC,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AA5KD,gDA4KC"}
@@ -0,0 +1,20 @@
1
+ import { ApplicationCommand, AutoModerationRule, Channel, GuildScheduledEvent, Integration, User, Webhook } from ".";
2
+ import type { Client } from "../Client";
3
+ import type { JSONAuditLog, JSONAuditLogEntry, RawAuditLog } from "../types";
4
+ /** https://discord.com/developers/docs/resources/audit-log */
5
+ export declare class AuditLog {
6
+ private client;
7
+ private raw;
8
+ applicationCommands: Array<ApplicationCommand>;
9
+ auditLogEntries: Array<JSONAuditLogEntry>;
10
+ autoModerationRules: Array<AutoModerationRule>;
11
+ guildScheduledEvents: Array<GuildScheduledEvent>;
12
+ integrations: Array<Integration>;
13
+ threads: Array<Channel>;
14
+ users: Array<User>;
15
+ webhooks: Array<Webhook>;
16
+ constructor(data: RawAuditLog, client: Client);
17
+ toString(): string;
18
+ toRaw(): RawAuditLog;
19
+ toJSON(): JSONAuditLog;
20
+ }
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuditLog = void 0;
4
+ const _1 = require(".");
5
+ /** https://discord.com/developers/docs/resources/audit-log */
6
+ class AuditLog {
7
+ client;
8
+ raw;
9
+ applicationCommands;
10
+ auditLogEntries;
11
+ autoModerationRules;
12
+ guildScheduledEvents;
13
+ integrations;
14
+ threads;
15
+ users;
16
+ webhooks;
17
+ constructor(data, client) {
18
+ this.client = client;
19
+ this.raw = data;
20
+ this.applicationCommands = data.application_commands.map((applicationCommand) => new _1.ApplicationCommand(applicationCommand, this.client));
21
+ this.auditLogEntries = data.audit_log_entries.map((auditLogEntry) => ({
22
+ targetId: auditLogEntry.target_id,
23
+ changes: auditLogEntry.changes?.map((change) => ({
24
+ newValue: change.new_value,
25
+ oldValue: change.old_value,
26
+ key: change.key,
27
+ })),
28
+ userId: auditLogEntry.user_id,
29
+ id: auditLogEntry.id,
30
+ actionType: auditLogEntry.action_type,
31
+ options: auditLogEntry.options !== undefined
32
+ ? {
33
+ applicationId: auditLogEntry.options.application_id,
34
+ autoModerationRuleName: auditLogEntry.options.auto_moderation_rule_name,
35
+ autoModerationRuleTriggerType: auditLogEntry.options.auto_moderation_rule_trigger_type,
36
+ channelId: auditLogEntry.options.channel_id,
37
+ count: auditLogEntry.options.count,
38
+ deleteMemberDays: auditLogEntry.options.delete_member_days,
39
+ id: auditLogEntry.options.id,
40
+ membersRemoved: auditLogEntry.options.members_removed,
41
+ messageId: auditLogEntry.options.message_id,
42
+ roleName: auditLogEntry.options.role_name,
43
+ type: auditLogEntry.options.type,
44
+ integrationType: auditLogEntry.options.integration_type,
45
+ }
46
+ : undefined,
47
+ reason: auditLogEntry.reason,
48
+ }));
49
+ this.autoModerationRules = data.auto_moderation_rules.map((autoModerationRule) => new _1.AutoModerationRule(autoModerationRule, this.client));
50
+ this.guildScheduledEvents = data.guild_scheduled_events.map((guildScheduledEvent) => new _1.GuildScheduledEvent(guildScheduledEvent, this.client));
51
+ this.integrations = data.integrations.map((integration) => new _1.Integration(integration, this.client));
52
+ this.threads = data.threads.map((thread) => new _1.Channel(thread, this.client));
53
+ this.users = data.users.map((user) => new _1.User(user, this.client));
54
+ this.webhooks = data.webhooks.map((webhook) => new _1.Webhook(webhook, this.client));
55
+ }
56
+ toString() {
57
+ return `[${this.constructor.name}]`;
58
+ }
59
+ toRaw() {
60
+ return this.raw;
61
+ }
62
+ toJSON() {
63
+ return {
64
+ applicationCommands: this.applicationCommands.map((applicationCommand) => applicationCommand.toJSON()),
65
+ auditLogEntries: this.auditLogEntries,
66
+ autoModerationRules: this.autoModerationRules.map((autoModerationRule) => autoModerationRule.toJSON()),
67
+ guildScheduledEvents: this.guildScheduledEvents.map((guildScheduledEvent) => guildScheduledEvent.toJSON()),
68
+ integrations: this.integrations.map((integration) => integration.toJSON()),
69
+ threads: this.threads.map((thread) => thread.toJSON()),
70
+ users: this.users.map((user) => user.toJSON()),
71
+ webhooks: this.webhooks.map((webhook) => webhook.toJSON()),
72
+ };
73
+ }
74
+ }
75
+ exports.AuditLog = AuditLog;
76
+ //# sourceMappingURL=AuditLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuditLog.js","sourceRoot":"","sources":["../../../lib/structures/AuditLog.ts"],"names":[],"mappings":";;;AAAA,wBAQW;AAIX,8DAA8D;AAC9D,MAAa,QAAQ;IACX,MAAM,CAAS;IACf,GAAG,CAAc;IACzB,mBAAmB,CAA4B;IAC/C,eAAe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