disgroove 1.3.3-dev.2 → 1.3.3-dev.3

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