disgroove 1.3.1 → 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 (267) hide show
  1. package/README.md +1 -1
  2. package/dist/lib/Client.d.ts +234 -0
  3. package/dist/lib/Client.js +256 -0
  4. package/dist/lib/Client.js.map +1 -0
  5. package/dist/lib/constants.d.ts +1084 -0
  6. package/dist/lib/constants.js +1163 -0
  7. package/dist/lib/constants.js.map +1 -0
  8. package/dist/lib/gateway/Shard.d.ts +25 -0
  9. package/dist/lib/gateway/Shard.js +522 -0
  10. package/dist/lib/gateway/Shard.js.map +1 -0
  11. package/dist/lib/gateway/ShardsManager.d.ts +5 -0
  12. package/dist/lib/gateway/ShardsManager.js +13 -0
  13. package/dist/lib/gateway/ShardsManager.js.map +1 -0
  14. package/dist/lib/gateway/index.d.ts +2 -0
  15. package/dist/lib/gateway/index.js +19 -0
  16. package/dist/lib/gateway/index.js.map +1 -0
  17. package/dist/lib/index.d.ts +7 -0
  18. package/dist/lib/index.js +24 -0
  19. package/dist/lib/index.js.map +1 -0
  20. package/dist/lib/rest/CDN.d.ts +21 -0
  21. package/dist/lib/rest/CDN.js +46 -0
  22. package/dist/lib/rest/CDN.js.map +1 -0
  23. package/dist/lib/rest/Endpoints.d.ts +94 -0
  24. package/dist/lib/rest/Endpoints.js +211 -0
  25. package/dist/lib/rest/Endpoints.js.map +1 -0
  26. package/dist/lib/rest/REST.d.ts +22 -0
  27. package/dist/lib/rest/REST.js +35 -0
  28. package/dist/lib/rest/REST.js.map +1 -0
  29. package/dist/lib/rest/RequestsManager.d.ts +17 -0
  30. package/dist/lib/rest/RequestsManager.js +124 -0
  31. package/dist/lib/rest/RequestsManager.js.map +1 -0
  32. package/dist/lib/rest/index.d.ts +4 -0
  33. package/dist/lib/rest/index.js +34 -0
  34. package/dist/lib/rest/index.js.map +1 -0
  35. package/dist/lib/structures/Application.d.ts +174 -0
  36. package/dist/lib/structures/Application.js +328 -0
  37. package/dist/lib/structures/Application.js.map +1 -0
  38. package/dist/lib/structures/ApplicationCommand.d.ts +45 -0
  39. package/dist/lib/structures/ApplicationCommand.js +127 -0
  40. package/dist/lib/structures/ApplicationCommand.js.map +1 -0
  41. package/dist/lib/structures/AuditLog.d.ts +20 -0
  42. package/dist/lib/structures/AuditLog.js +76 -0
  43. package/dist/lib/structures/AuditLog.js.map +1 -0
  44. package/dist/lib/structures/AutoModerationRule.d.ts +34 -0
  45. package/dist/lib/structures/AutoModerationRule.js +96 -0
  46. package/dist/lib/structures/AutoModerationRule.js.map +1 -0
  47. package/dist/lib/structures/Base.d.ts +17 -0
  48. package/dist/lib/structures/Base.js +31 -0
  49. package/dist/lib/structures/Base.js.map +1 -0
  50. package/dist/lib/structures/Channel.d.ts +253 -0
  51. package/dist/lib/structures/Channel.js +591 -0
  52. package/dist/lib/structures/Channel.js.map +1 -0
  53. package/dist/lib/structures/ClientApplication.d.ts +150 -0
  54. package/dist/lib/structures/ClientApplication.js +241 -0
  55. package/dist/lib/structures/ClientApplication.js.map +1 -0
  56. package/dist/lib/structures/Emoji.d.ts +28 -0
  57. package/dist/lib/structures/Emoji.js +79 -0
  58. package/dist/lib/structures/Emoji.js.map +1 -0
  59. package/dist/lib/structures/Entitlement.d.ts +24 -0
  60. package/dist/lib/structures/Entitlement.js +68 -0
  61. package/dist/lib/structures/Entitlement.js.map +1 -0
  62. package/dist/lib/structures/Guild.d.ts +462 -0
  63. package/dist/lib/structures/Guild.js +1095 -0
  64. package/dist/lib/structures/Guild.js.map +1 -0
  65. package/dist/lib/structures/GuildMember.d.ts +50 -0
  66. package/dist/lib/structures/GuildMember.js +149 -0
  67. package/dist/lib/structures/GuildMember.js.map +1 -0
  68. package/dist/lib/structures/GuildScheduledEvent.d.ts +49 -0
  69. package/dist/lib/structures/GuildScheduledEvent.js +118 -0
  70. package/dist/lib/structures/GuildScheduledEvent.js.map +1 -0
  71. package/dist/lib/structures/GuildTemplate.d.ts +32 -0
  72. package/dist/lib/structures/GuildTemplate.js +76 -0
  73. package/dist/lib/structures/GuildTemplate.js.map +1 -0
  74. package/dist/lib/structures/Integration.d.ts +30 -0
  75. package/dist/lib/structures/Integration.js +102 -0
  76. package/dist/lib/structures/Integration.js.map +1 -0
  77. package/dist/lib/structures/Interaction.d.ts +76 -0
  78. package/dist/lib/structures/Interaction.js +345 -0
  79. package/dist/lib/structures/Interaction.js.map +1 -0
  80. package/dist/lib/structures/Invite.d.ts +28 -0
  81. package/dist/lib/structures/Invite.js +86 -0
  82. package/dist/lib/structures/Invite.js.map +1 -0
  83. package/dist/lib/structures/Message.d.ts +84 -0
  84. package/dist/lib/structures/Message.js +300 -0
  85. package/dist/lib/structures/Message.js.map +1 -0
  86. package/dist/lib/structures/Role.d.ts +37 -0
  87. package/dist/lib/structures/Role.js +90 -0
  88. package/dist/lib/structures/Role.js.map +1 -0
  89. package/dist/lib/structures/SKU.d.ts +23 -0
  90. package/dist/lib/structures/SKU.js +63 -0
  91. package/dist/lib/structures/SKU.js.map +1 -0
  92. package/dist/lib/structures/StageInstance.d.ts +24 -0
  93. package/dist/lib/structures/StageInstance.js +57 -0
  94. package/dist/lib/structures/StageInstance.js.map +1 -0
  95. package/dist/lib/structures/Sticker.d.ts +31 -0
  96. package/dist/lib/structures/Sticker.js +86 -0
  97. package/dist/lib/structures/Sticker.js.map +1 -0
  98. package/dist/lib/structures/Team.d.ts +14 -0
  99. package/dist/lib/structures/Team.js +39 -0
  100. package/dist/lib/structures/Team.js.map +1 -0
  101. package/dist/lib/structures/TestEntitlement.d.ts +23 -0
  102. package/dist/lib/structures/TestEntitlement.js +61 -0
  103. package/dist/lib/structures/TestEntitlement.js.map +1 -0
  104. package/dist/lib/structures/UnavailableGuild.d.ts +11 -0
  105. package/dist/lib/structures/UnavailableGuild.js +25 -0
  106. package/dist/lib/structures/UnavailableGuild.js.map +1 -0
  107. package/dist/lib/structures/User.d.ts +63 -0
  108. package/dist/lib/structures/User.js +177 -0
  109. package/dist/lib/structures/User.js.map +1 -0
  110. package/dist/lib/structures/VoiceState.d.ts +26 -0
  111. package/dist/lib/structures/VoiceState.js +70 -0
  112. package/dist/lib/structures/VoiceState.js.map +1 -0
  113. package/dist/lib/structures/Webhook.d.ts +84 -0
  114. package/dist/lib/structures/Webhook.js +239 -0
  115. package/dist/lib/structures/Webhook.js.map +1 -0
  116. package/dist/lib/structures/index.d.ts +27 -0
  117. package/dist/lib/structures/index.js +44 -0
  118. package/dist/lib/structures/index.js.map +1 -0
  119. package/dist/lib/types/application-command.d.ts +102 -0
  120. package/dist/lib/types/application-command.js +3 -0
  121. package/dist/lib/types/application-command.js.map +1 -0
  122. package/dist/lib/types/application-role-connection-metadata.d.ts +18 -0
  123. package/dist/lib/types/application-role-connection-metadata.js +3 -0
  124. package/dist/lib/types/application-role-connection-metadata.js.map +1 -0
  125. package/dist/lib/types/application.d.ts +66 -0
  126. package/dist/lib/types/application.js +3 -0
  127. package/dist/lib/types/application.js.map +1 -0
  128. package/dist/lib/types/audit-log.d.ts +82 -0
  129. package/dist/lib/types/audit-log.js +3 -0
  130. package/dist/lib/types/audit-log.js.map +1 -0
  131. package/dist/lib/types/auto-moderation.d.ts +65 -0
  132. package/dist/lib/types/auto-moderation.js +3 -0
  133. package/dist/lib/types/auto-moderation.js.map +1 -0
  134. package/dist/lib/types/channel.d.ts +456 -0
  135. package/dist/lib/types/channel.js +3 -0
  136. package/dist/lib/types/channel.js.map +1 -0
  137. package/dist/lib/types/emoji.d.ts +22 -0
  138. package/dist/lib/types/emoji.js +3 -0
  139. package/dist/lib/types/emoji.js.map +1 -0
  140. package/dist/lib/types/entitlements.d.ts +32 -0
  141. package/dist/lib/types/entitlements.js +3 -0
  142. package/dist/lib/types/entitlements.js.map +1 -0
  143. package/dist/lib/types/gateway-events.d.ts +805 -0
  144. package/dist/lib/types/gateway-events.js +3 -0
  145. package/dist/lib/types/gateway-events.js.map +1 -0
  146. package/dist/lib/types/guild-scheduled-event.d.ts +57 -0
  147. package/dist/lib/types/guild-scheduled-event.js +3 -0
  148. package/dist/lib/types/guild-scheduled-event.js.map +1 -0
  149. package/dist/lib/types/guild-template.d.ts +28 -0
  150. package/dist/lib/types/guild-template.js +3 -0
  151. package/dist/lib/types/guild-template.js.map +1 -0
  152. package/dist/lib/types/guild.d.ts +333 -0
  153. package/dist/lib/types/guild.js +3 -0
  154. package/dist/lib/types/guild.js.map +1 -0
  155. package/dist/lib/types/index.d.ts +23 -0
  156. package/dist/lib/types/index.js +40 -0
  157. package/dist/lib/types/index.js.map +1 -0
  158. package/dist/lib/types/interaction.d.ts +170 -0
  159. package/dist/lib/types/interaction.js +3 -0
  160. package/dist/lib/types/interaction.js.map +1 -0
  161. package/dist/lib/types/invite.d.ts +59 -0
  162. package/dist/lib/types/invite.js +3 -0
  163. package/dist/lib/types/invite.js.map +1 -0
  164. package/dist/lib/types/message-components.d.ts +100 -0
  165. package/dist/lib/types/message-components.js +3 -0
  166. package/dist/lib/types/message-components.js.map +1 -0
  167. package/dist/lib/types/role.d.ts +47 -0
  168. package/dist/lib/types/role.js +3 -0
  169. package/dist/lib/types/role.js.map +1 -0
  170. package/dist/lib/types/sku.d.ts +30 -0
  171. package/dist/lib/types/sku.js +3 -0
  172. package/dist/lib/types/sku.js.map +1 -0
  173. package/dist/lib/types/stage-instance.d.ts +20 -0
  174. package/dist/lib/types/stage-instance.js +3 -0
  175. package/dist/lib/types/stage-instance.js.map +1 -0
  176. package/dist/lib/types/sticker.d.ts +61 -0
  177. package/dist/lib/types/sticker.js +3 -0
  178. package/dist/lib/types/sticker.js.map +1 -0
  179. package/dist/lib/types/team.d.ts +30 -0
  180. package/dist/lib/types/team.js +3 -0
  181. package/dist/lib/types/team.js.map +1 -0
  182. package/dist/lib/types/user.d.ts +77 -0
  183. package/dist/lib/types/user.js +3 -0
  184. package/dist/lib/types/user.js.map +1 -0
  185. package/dist/lib/types/voice.d.ts +47 -0
  186. package/dist/lib/types/voice.js +3 -0
  187. package/dist/lib/types/voice.js.map +1 -0
  188. package/dist/lib/types/webhook.d.ts +31 -0
  189. package/dist/lib/types/webhook.js +3 -0
  190. package/dist/lib/types/webhook.js.map +1 -0
  191. package/dist/lib/utils/Util.d.ts +15 -0
  192. package/dist/lib/utils/Util.js +543 -0
  193. package/dist/lib/utils/Util.js.map +1 -0
  194. package/dist/lib/utils/errors.d.ts +12 -0
  195. package/dist/lib/utils/errors.js +25 -0
  196. package/dist/lib/utils/errors.js.map +1 -0
  197. package/dist/lib/utils/index.d.ts +2 -0
  198. package/dist/lib/utils/index.js +19 -0
  199. package/dist/lib/utils/index.js.map +1 -0
  200. package/dist/package.json +1 -1
  201. package/lib/Client.ts +616 -0
  202. package/lib/constants.ts +1173 -0
  203. package/lib/gateway/Shard.ts +704 -0
  204. package/lib/gateway/ShardsManager.ts +11 -0
  205. package/lib/gateway/index.ts +2 -0
  206. package/lib/index.ts +7 -0
  207. package/lib/rest/CDN.ts +56 -0
  208. package/lib/rest/Endpoints.ts +241 -0
  209. package/lib/rest/REST.ts +45 -0
  210. package/lib/rest/RequestsManager.ts +134 -0
  211. package/lib/rest/index.ts +4 -0
  212. package/lib/structures/Application.ts +599 -0
  213. package/lib/structures/ApplicationCommand.ts +187 -0
  214. package/lib/structures/AuditLog.ts +112 -0
  215. package/lib/structures/AutoModerationRule.ts +127 -0
  216. package/lib/structures/Base.ts +39 -0
  217. package/lib/structures/Channel.ts +921 -0
  218. package/lib/structures/ClientApplication.ts +515 -0
  219. package/lib/structures/Emoji.ts +95 -0
  220. package/lib/structures/Entitlement.ts +65 -0
  221. package/lib/structures/Guild.ts +1842 -0
  222. package/lib/structures/GuildMember.ts +193 -0
  223. package/lib/structures/GuildScheduledEvent.ts +164 -0
  224. package/lib/structures/GuildTemplate.ts +103 -0
  225. package/lib/structures/Integration.ts +136 -0
  226. package/lib/structures/Interaction.ts +506 -0
  227. package/lib/structures/Invite.ts +108 -0
  228. package/lib/structures/Message.ts +421 -0
  229. package/lib/structures/Role.ts +116 -0
  230. package/lib/structures/SKU.ts +63 -0
  231. package/lib/structures/StageInstance.ts +74 -0
  232. package/lib/structures/Sticker.ts +100 -0
  233. package/lib/structures/Team.ts +41 -0
  234. package/lib/structures/TestEntitlement.ts +78 -0
  235. package/lib/structures/UnavailableGuild.ts +27 -0
  236. package/lib/structures/User.ts +233 -0
  237. package/lib/structures/VoiceState.ts +72 -0
  238. package/lib/structures/Webhook.ts +341 -0
  239. package/lib/structures/index.ts +27 -0
  240. package/lib/types/application-command.ts +118 -0
  241. package/lib/types/application-role-connection-metadata.ts +23 -0
  242. package/lib/types/application.ts +77 -0
  243. package/lib/types/audit-log.ts +105 -0
  244. package/lib/types/auto-moderation.ts +78 -0
  245. package/lib/types/channel.ts +534 -0
  246. package/lib/types/emoji.ts +24 -0
  247. package/lib/types/entitlements.ts +34 -0
  248. package/lib/types/gateway-events.ts +970 -0
  249. package/lib/types/guild-scheduled-event.ts +67 -0
  250. package/lib/types/guild-template.ts +30 -0
  251. package/lib/types/guild.ts +388 -0
  252. package/lib/types/index.ts +23 -0
  253. package/lib/types/interaction.ts +224 -0
  254. package/lib/types/invite.ts +78 -0
  255. package/lib/types/message-components.ts +127 -0
  256. package/lib/types/role.ts +51 -0
  257. package/lib/types/sku.ts +32 -0
  258. package/lib/types/stage-instance.ts +22 -0
  259. package/lib/types/sticker.ts +67 -0
  260. package/lib/types/team.ts +34 -0
  261. package/lib/types/user.ts +93 -0
  262. package/lib/types/voice.ts +51 -0
  263. package/lib/types/webhook.ts +40 -0
  264. package/lib/utils/Util.ts +600 -0
  265. package/lib/utils/errors.ts +23 -0
  266. package/lib/utils/index.ts +2 -0
  267. package/package.json +1 -1
@@ -0,0 +1,47 @@
1
+ import type { JSONGuildMember, RawGuildMember } from ".";
2
+ /** https://discord.com/developers/docs/resources/voice#voice-state-object-voice-state-structure */
3
+ export interface RawVoiceState {
4
+ guild_id?: string;
5
+ channel_id: string | null;
6
+ user_id: string;
7
+ member?: RawGuildMember;
8
+ session_id: string;
9
+ deaf: boolean;
10
+ mute: boolean;
11
+ self_deaf: boolean;
12
+ self_mute: boolean;
13
+ self_stream?: boolean;
14
+ self_video: boolean;
15
+ suppress: boolean;
16
+ request_to_speak_timestamp: string | null;
17
+ }
18
+ /** https://discord.com/developers/docs/resources/voice#voice-region-object-voice-region-structure */
19
+ export interface RawVoiceRegion {
20
+ id: string;
21
+ name: string;
22
+ optimal: boolean;
23
+ deprecated: boolean;
24
+ custom: boolean;
25
+ }
26
+ export interface JSONVoiceState {
27
+ guildId?: string;
28
+ channelId: string | null;
29
+ userId: string;
30
+ member?: JSONGuildMember;
31
+ sessionId: string;
32
+ deaf: boolean;
33
+ mute: boolean;
34
+ selfDeaf: boolean;
35
+ selfMute: boolean;
36
+ selfStream?: boolean;
37
+ selfVideo: boolean;
38
+ suppress: boolean;
39
+ requestToSpeakTimestamp: string | null;
40
+ }
41
+ export interface JSONVoiceRegion {
42
+ id: string;
43
+ name: string;
44
+ optimal: boolean;
45
+ deprecated: boolean;
46
+ custom: boolean;
47
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=voice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice.js","sourceRoot":"","sources":["../../../lib/types/voice.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import type { WebhookTypes } from "../constants";
2
+ import type { JSONChannel, JSONGuild, JSONUser, RawChannel, RawGuild, RawUser } from ".";
3
+ /** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */
4
+ export interface RawWebhook {
5
+ id: string;
6
+ type: WebhookTypes;
7
+ guild_id?: string | null;
8
+ channel_id: string | null;
9
+ user?: RawUser;
10
+ name: string | null;
11
+ avatar: string | null;
12
+ token?: string;
13
+ application_id: string | null;
14
+ source_guild?: RawGuild;
15
+ source_channel?: RawChannel;
16
+ url?: string;
17
+ }
18
+ export interface JSONWebhook {
19
+ id: string;
20
+ type: WebhookTypes;
21
+ guildId?: string | null;
22
+ channelId: string | null;
23
+ user?: JSONUser;
24
+ name: string | null;
25
+ avatar: string | null;
26
+ token?: string;
27
+ applicationId: string | null;
28
+ sourceGuild?: JSONGuild;
29
+ sourceChannel?: JSONChannel;
30
+ url?: string;
31
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=webhook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../../lib/types/webhook.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { JSONActionRow, JSONApplicationCommand, JSONAttachment, JSONChannel, JSONEmbed, JSONEmoji, JSONRole, JSONUser, PresenceUpdateEventFields, RawActionRow, RawApplicationCommand, RawAttachment, RawChannel, RawEmbed, RawEmoji, RawPresenceUpdateEventFields, RawRole, RawUser } from "../types";
2
+ import type { Client } from "../Client";
3
+ export declare class Util {
4
+ applicationCommandToRaw(command: Partial<JSONApplicationCommand>): Partial<RawApplicationCommand>;
5
+ attachmentToJSON(attachment: RawAttachment): JSONAttachment;
6
+ channelToRaw(channel: JSONChannel): RawChannel;
7
+ embedsToJSON(embeds: Array<RawEmbed>): Array<JSONEmbed>;
8
+ embedsToRaw(embeds: Array<JSONEmbed>): Array<RawEmbed>;
9
+ emojiToRaw(emoji: JSONEmoji): RawEmoji;
10
+ messageComponentsToJSON(components: Array<RawActionRow>): Array<JSONActionRow>;
11
+ messageComponentsToRaw(components: Array<JSONActionRow>): Array<RawActionRow>;
12
+ presenceToREST(presence: RawPresenceUpdateEventFields, client: Client): PresenceUpdateEventFields;
13
+ roleToRaw(role: JSONRole | Partial<JSONRole>): RawRole | Partial<RawRole>;
14
+ userToRaw(user: JSONUser): RawUser;
15
+ }
@@ -0,0 +1,543 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Util = void 0;
4
+ const constants_1 = require("../constants");
5
+ const structures_1 = require("../structures");
6
+ class Util {
7
+ applicationCommandToRaw(command) {
8
+ return {
9
+ id: command.id,
10
+ type: command.type,
11
+ application_id: command.applicationId,
12
+ guild_id: command.guildId,
13
+ name: command.name,
14
+ name_localizations: command.nameLocalizations,
15
+ description: command.description,
16
+ description_localizations: command.descriptionLocalizations,
17
+ options: command.options?.map((option) => ({
18
+ type: option.type,
19
+ name: option.name,
20
+ name_localizations: option.nameLocalizations,
21
+ description: option.description,
22
+ description_localizations: option.descriptionLocalizations,
23
+ required: option.required,
24
+ choices: option.choices?.map((choice) => ({
25
+ name: choice.name,
26
+ name_localizations: choice.nameLocalizations,
27
+ value: choice.value,
28
+ })),
29
+ options: option.options?.map((o) => ({
30
+ type: o.type,
31
+ name: o.name,
32
+ name_localizations: o.nameLocalizations,
33
+ description: o.description,
34
+ description_localizations: o.descriptionLocalizations,
35
+ required: o.required,
36
+ choices: o.choices?.map((choice) => ({
37
+ name: choice.name,
38
+ name_localizations: choice.nameLocalizations,
39
+ value: choice.value,
40
+ })),
41
+ channel_types: o.channelTypes,
42
+ min_value: o.minValue,
43
+ max_value: o.maxValue,
44
+ min_length: o.minLength,
45
+ max_length: o.maxLength,
46
+ autocomplete: o.autocomplete,
47
+ })),
48
+ channel_types: option.channelTypes,
49
+ min_value: option.minValue,
50
+ max_value: option.maxValue,
51
+ min_length: option.minLength,
52
+ max_length: option.maxLength,
53
+ autocomplete: option.autocomplete,
54
+ })),
55
+ default_member_permissions: command.defaultMemberPermissions,
56
+ dm_permission: command.dmPermission,
57
+ default_permission: command.defaultPermission,
58
+ nsfw: command.nsfw,
59
+ version: command.version,
60
+ };
61
+ }
62
+ attachmentToJSON(attachment) {
63
+ return {
64
+ id: attachment.id,
65
+ filename: attachment.filename,
66
+ description: attachment.description,
67
+ contentType: attachment.content_type,
68
+ size: attachment.size,
69
+ url: attachment.url,
70
+ proxyURL: attachment.proxy_url,
71
+ height: attachment.height,
72
+ width: attachment.width,
73
+ ephemeral: attachment.ephemeral,
74
+ durationSecs: attachment.duration_secs,
75
+ waveform: attachment.waveform,
76
+ flags: attachment.flags,
77
+ };
78
+ }
79
+ channelToRaw(channel) {
80
+ return {
81
+ id: channel.id,
82
+ type: channel.type,
83
+ guild_id: channel.guildId,
84
+ position: channel.position,
85
+ permission_overwrites: channel.permissionOverwrites?.map((overwrite) => ({
86
+ id: overwrite.id,
87
+ type: overwrite.type,
88
+ allow: overwrite.allow,
89
+ deny: overwrite.deny,
90
+ })),
91
+ name: channel.name,
92
+ topic: channel.topic,
93
+ nsfw: channel.nsfw,
94
+ last_message_id: channel.lastMessageId,
95
+ bitrate: channel.bitrate,
96
+ user_limit: channel.userLimit,
97
+ rate_limit_per_user: channel.rateLimitPerUser,
98
+ recipients: channel.recipients?.map((recipient) => this.userToRaw(recipient)),
99
+ icon: channel.icon,
100
+ owner_id: channel.ownerId,
101
+ application_id: channel.applicationId,
102
+ managed: channel.managed,
103
+ parent_id: channel.parentId,
104
+ last_pin_timestamp: channel.lastPinTimestamp,
105
+ rtc_region: channel.rtcRegion,
106
+ video_quality_mode: channel.videoQualityMode,
107
+ message_count: channel.messageCount,
108
+ member_count: channel.memberCount,
109
+ thread_metadata: channel.threadMetadata !== undefined
110
+ ? {
111
+ archived: channel.threadMetadata?.archived,
112
+ auto_archive_duration: channel.threadMetadata?.autoArchiveDuration,
113
+ archive_timestamp: channel.threadMetadata?.archiveTimestamp,
114
+ locked: channel.threadMetadata?.locked,
115
+ invitable: channel.threadMetadata?.invitable,
116
+ create_timestamp: channel.threadMetadata?.createTimestamp,
117
+ }
118
+ : undefined,
119
+ member: channel.member !== undefined
120
+ ? {
121
+ id: channel.member.id,
122
+ user_id: channel.member.userId,
123
+ join_timestamp: channel.member.joinTimestamp,
124
+ flags: channel.member.flags,
125
+ member: channel.member.member !== undefined
126
+ ? {
127
+ user: channel.member.member.user !== undefined
128
+ ? this.userToRaw(channel.member.member.user)
129
+ : undefined,
130
+ nick: channel.member.member.nick,
131
+ avatar: channel.member.member.avatar,
132
+ roles: channel.member.member.roles,
133
+ joined_at: channel.member.member.joinedAt,
134
+ premium_since: channel.member.member.premiumSince,
135
+ deaf: channel.member.member.deaf,
136
+ mute: channel.member.member.mute,
137
+ flags: channel.member.member.flags,
138
+ pending: channel.member.member.pending,
139
+ permissions: channel.member.member.permissions,
140
+ communication_disabled_until: channel.member.member.communicationDisabledUntil,
141
+ }
142
+ : undefined,
143
+ }
144
+ : undefined,
145
+ default_auto_archive_duration: channel.defaultAutoArchiveDuration,
146
+ permissions: channel.permissions,
147
+ flags: channel.flags,
148
+ total_message_sent: channel.totalMessageSent,
149
+ available_tags: channel.availableTags?.map((availableTag) => ({
150
+ id: availableTag.id,
151
+ name: availableTag.name,
152
+ moderated: availableTag.moderated,
153
+ emoji_id: availableTag.emojiId,
154
+ emoji_name: availableTag.emojiName,
155
+ })),
156
+ applied_tags: channel.appliedTags,
157
+ default_reaction_emoji: channel.defaultReactionEmoji !== undefined
158
+ ? channel.defaultReactionEmoji !== null
159
+ ? {
160
+ emoji_id: channel.defaultReactionEmoji.emojiId,
161
+ emoji_name: channel.defaultReactionEmoji.emojiName,
162
+ }
163
+ : null
164
+ : undefined,
165
+ default_thread_rate_limit_per_user: channel.defaultThreadRateLimitPerUser,
166
+ default_sort_order: channel.defaultSortOrder,
167
+ default_forum_layout: channel.defaultForumLayout,
168
+ };
169
+ }
170
+ embedsToJSON(embeds) {
171
+ return embeds.map((embed) => ({
172
+ title: embed.title,
173
+ type: embed.type,
174
+ description: embed.description,
175
+ url: embed.url,
176
+ timestamp: embed.timestamp,
177
+ color: embed.color,
178
+ footer: embed.footer !== undefined
179
+ ? {
180
+ text: embed.footer.text,
181
+ iconURL: embed.footer.icon_url,
182
+ proxyIconURL: embed.footer.proxy_icon_url,
183
+ }
184
+ : undefined,
185
+ image: embed.image !== undefined
186
+ ? {
187
+ url: embed.image.url,
188
+ proxyURL: embed.image.proxy_url,
189
+ height: embed.image.height,
190
+ width: embed.image.width,
191
+ }
192
+ : undefined,
193
+ thumbnail: embed.thumbnail !== undefined
194
+ ? {
195
+ url: embed.thumbnail.url,
196
+ proxyURL: embed.thumbnail.proxy_url,
197
+ height: embed.thumbnail.height,
198
+ width: embed.thumbnail.width,
199
+ }
200
+ : undefined,
201
+ video: {
202
+ url: embed.video?.url,
203
+ proxyURL: embed.video?.proxy_url,
204
+ height: embed.video?.height,
205
+ width: embed.video?.width,
206
+ },
207
+ provider: {
208
+ name: embed.provider?.name,
209
+ url: embed.provider?.url,
210
+ },
211
+ author: embed.author !== undefined
212
+ ? {
213
+ name: embed.author.name,
214
+ url: embed.author.url,
215
+ iconURL: embed.author.icon_url,
216
+ proxyIconURL: embed.author.proxy_icon_url,
217
+ }
218
+ : undefined,
219
+ fields: embed.fields?.map((field) => ({
220
+ name: field.name,
221
+ value: field.value,
222
+ inline: field.inline,
223
+ })),
224
+ }));
225
+ }
226
+ embedsToRaw(embeds) {
227
+ return embeds.map((embed) => ({
228
+ title: embed.title,
229
+ type: embed.type,
230
+ description: embed.description,
231
+ url: embed.url,
232
+ timestamp: embed.timestamp,
233
+ color: embed.color,
234
+ footer: embed.footer !== undefined
235
+ ? {
236
+ text: embed.footer.text,
237
+ icon_url: embed.footer.iconURL,
238
+ proxy_icon_url: embed.footer.proxyIconURL,
239
+ }
240
+ : undefined,
241
+ image: embed.image !== undefined
242
+ ? {
243
+ url: embed.image.url,
244
+ proxy_url: embed.image.proxyURL,
245
+ height: embed.image.height,
246
+ width: embed.image.width,
247
+ }
248
+ : undefined,
249
+ thumbnail: embed.thumbnail !== undefined
250
+ ? {
251
+ url: embed.thumbnail.url,
252
+ proxy_url: embed.thumbnail.proxyURL,
253
+ height: embed.thumbnail.height,
254
+ width: embed.thumbnail.width,
255
+ }
256
+ : undefined,
257
+ video: {
258
+ url: embed.video?.url,
259
+ proxy_url: embed.video?.proxyURL,
260
+ height: embed.video?.height,
261
+ width: embed.video?.width,
262
+ },
263
+ provider: {
264
+ name: embed.provider?.name,
265
+ url: embed.provider?.url,
266
+ },
267
+ author: embed.author !== undefined
268
+ ? {
269
+ name: embed.author.name,
270
+ url: embed.author.url,
271
+ icon_url: embed.author.iconURL,
272
+ proxy_icon_url: embed.author.proxyIconURL,
273
+ }
274
+ : undefined,
275
+ fields: embed.fields?.map((field) => ({
276
+ name: field.name,
277
+ value: field.value,
278
+ inline: field.inline,
279
+ })),
280
+ }));
281
+ }
282
+ emojiToRaw(emoji) {
283
+ return {
284
+ id: emoji.id,
285
+ name: emoji.name,
286
+ roles: emoji.roles,
287
+ user: emoji.user !== undefined ? this.userToRaw(emoji.user) : undefined,
288
+ require_colons: emoji.requireColons,
289
+ managed: emoji.managed,
290
+ animated: emoji.animated,
291
+ available: emoji.available,
292
+ };
293
+ }
294
+ messageComponentsToJSON(components) {
295
+ return components.map((component) => ({
296
+ type: component.type,
297
+ components: component.components.map((c) => {
298
+ switch (c.type) {
299
+ case constants_1.ComponentTypes.Button: {
300
+ return {
301
+ type: c.type,
302
+ style: c.style,
303
+ label: c.label,
304
+ emoji: c.emoji !== undefined
305
+ ? {
306
+ name: c.emoji.name,
307
+ id: c.emoji.id,
308
+ animated: c.emoji.animated,
309
+ }
310
+ : undefined,
311
+ customId: c.custom_id,
312
+ url: c.url,
313
+ disabled: c.disabled,
314
+ };
315
+ }
316
+ case constants_1.ComponentTypes.TextInput: {
317
+ return {
318
+ type: c.type,
319
+ customId: c.custom_id,
320
+ style: c.style,
321
+ label: c.label,
322
+ minLength: c.min_length,
323
+ maxLength: c.max_length,
324
+ required: c.required,
325
+ value: c.value,
326
+ placeholder: c.placeholder,
327
+ };
328
+ }
329
+ case constants_1.ComponentTypes.ChannelSelect: {
330
+ return {
331
+ type: c.type,
332
+ customId: c.custom_id,
333
+ channelTypes: c.channel_types,
334
+ placeholder: c.placeholder,
335
+ defaultValues: c.default_values,
336
+ minValues: c.min_values,
337
+ maxValues: c.max_values,
338
+ disabled: c.disabled,
339
+ };
340
+ }
341
+ case constants_1.ComponentTypes.StringSelect: {
342
+ return {
343
+ type: c.type,
344
+ customId: c.custom_id,
345
+ placeholder: c.placeholder,
346
+ options: c.options?.map((option) => ({
347
+ label: option.label,
348
+ value: option.value,
349
+ description: option.description,
350
+ emoji: option.emoji !== undefined
351
+ ? {
352
+ name: option.emoji.name,
353
+ id: option.emoji.id,
354
+ animated: option.emoji.animated,
355
+ }
356
+ : undefined,
357
+ default: option.default,
358
+ })),
359
+ minValues: c.min_values,
360
+ maxValues: c.max_values,
361
+ disabled: c.disabled,
362
+ };
363
+ }
364
+ case constants_1.ComponentTypes.MentionableSelect:
365
+ case constants_1.ComponentTypes.RoleSelect:
366
+ case constants_1.ComponentTypes.UserSelect: {
367
+ return {
368
+ type: c.type,
369
+ customId: c.custom_id,
370
+ placeholder: c.placeholder,
371
+ defaultValues: c.default_values,
372
+ minValues: c.min_values,
373
+ maxValues: c.max_values,
374
+ disabled: c.disabled,
375
+ };
376
+ }
377
+ }
378
+ }),
379
+ }));
380
+ }
381
+ messageComponentsToRaw(components) {
382
+ return components.map((component) => ({
383
+ type: component.type,
384
+ components: component.components.map((c) => {
385
+ switch (c.type) {
386
+ case constants_1.ComponentTypes.Button: {
387
+ return {
388
+ type: c.type,
389
+ style: c.style,
390
+ label: c.label,
391
+ emoji: c.emoji !== undefined
392
+ ? {
393
+ name: c.emoji.name,
394
+ id: c.emoji.id,
395
+ animated: c.emoji.animated,
396
+ }
397
+ : undefined,
398
+ custom_id: c.customId,
399
+ url: c.url,
400
+ disabled: c.disabled,
401
+ };
402
+ }
403
+ case constants_1.ComponentTypes.TextInput: {
404
+ return {
405
+ type: c.type,
406
+ custom_id: c.customId,
407
+ style: c.style,
408
+ label: c.label,
409
+ min_length: c.minLength,
410
+ max_length: c.maxLength,
411
+ required: c.required,
412
+ value: c.value,
413
+ placeholder: c.placeholder,
414
+ };
415
+ }
416
+ case constants_1.ComponentTypes.ChannelSelect: {
417
+ return {
418
+ type: c.type,
419
+ custom_id: c.customId,
420
+ channel_types: c.channelTypes,
421
+ placeholder: c.placeholder,
422
+ default_values: c.defaultValues,
423
+ min_values: c.minValues,
424
+ max_values: c.maxValues,
425
+ disabled: c.disabled,
426
+ };
427
+ }
428
+ case constants_1.ComponentTypes.StringSelect: {
429
+ return {
430
+ type: c.type,
431
+ custom_id: c.customId,
432
+ placeholder: c.placeholder,
433
+ options: c.options?.map((option) => ({
434
+ label: option.label,
435
+ value: option.value,
436
+ description: option.description,
437
+ emoji: option.emoji !== undefined
438
+ ? {
439
+ name: option.emoji.name,
440
+ id: option.emoji.id,
441
+ animated: option.emoji.animated,
442
+ }
443
+ : undefined,
444
+ default: option.default,
445
+ })),
446
+ min_values: c.minValues,
447
+ max_values: c.maxValues,
448
+ disabled: c.disabled,
449
+ };
450
+ }
451
+ case constants_1.ComponentTypes.MentionableSelect:
452
+ case constants_1.ComponentTypes.RoleSelect:
453
+ case constants_1.ComponentTypes.UserSelect: {
454
+ return {
455
+ type: c.type,
456
+ custom_id: c.customId,
457
+ placeholder: c.placeholder,
458
+ default_values: c.defaultValues,
459
+ min_values: c.minValues,
460
+ max_values: c.maxValues,
461
+ disabled: c.disabled,
462
+ };
463
+ }
464
+ }
465
+ }),
466
+ }));
467
+ }
468
+ presenceToREST(presence, client) {
469
+ return {
470
+ user: new structures_1.User(presence.user, client),
471
+ guildId: presence.guild_id,
472
+ status: presence.status,
473
+ activities: presence.activities.map((activity) => ({
474
+ name: activity.name,
475
+ type: activity.type,
476
+ url: activity.url,
477
+ createdAt: activity.created_at,
478
+ timestamps: activity.timestamps,
479
+ applicationId: activity.application_id,
480
+ details: activity.details,
481
+ state: activity.state,
482
+ party: activity.party,
483
+ assets: {
484
+ largeImage: activity.assets?.large_image,
485
+ largeText: activity.assets?.large_text,
486
+ smallImage: activity.assets?.small_image,
487
+ smallText: activity.assets?.small_text,
488
+ },
489
+ secrets: activity.secrets,
490
+ instance: activity.instance,
491
+ flags: activity.flags,
492
+ buttons: activity.buttons,
493
+ })),
494
+ clientStatus: presence.client_status,
495
+ };
496
+ }
497
+ roleToRaw(role) {
498
+ return {
499
+ id: role.id,
500
+ name: role.name,
501
+ color: role.color,
502
+ hoist: role.hoist,
503
+ icon: role.icon,
504
+ unicode_emoji: role.unicodeEmoji,
505
+ position: role.position,
506
+ permissions: role.permissions,
507
+ managed: role.managed,
508
+ mentionable: role.mentionable,
509
+ tags: {
510
+ bot_id: role.tags?.botId,
511
+ integration_id: role.tags?.integrationId,
512
+ premium_subscriber: role.tags?.premiumSubscriber,
513
+ subscription_listing_id: role.tags?.subscriptionListingId,
514
+ available_for_purchase: role.tags?.availableForPurchase,
515
+ guild_connections: role.tags?.guildConnections,
516
+ },
517
+ flags: role.flags,
518
+ };
519
+ }
520
+ userToRaw(user) {
521
+ return {
522
+ id: user.id,
523
+ username: user.username,
524
+ discriminator: user.discriminator,
525
+ global_name: user.globalName,
526
+ avatar: user.avatar,
527
+ bot: user.bot,
528
+ system: user.system,
529
+ mfa_enabled: user.mfaEnabled,
530
+ banner: user.banner,
531
+ accent_color: user.accentColor,
532
+ locale: user.locale,
533
+ verified: user.verified,
534
+ email: user.email,
535
+ flags: user.flags,
536
+ premium_type: user.premiumType,
537
+ public_flags: user.publicFlags,
538
+ avatar_decoration: user.avatarDecoration,
539
+ };
540
+ }
541
+ }
542
+ exports.Util = Util;
543
+ //# sourceMappingURL=Util.js.map