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
@@ -1,421 +0,0 @@
1
- import {
2
- Application,
3
- Base,
4
- Channel,
5
- Emoji,
6
- GuildMember,
7
- Role,
8
- Sticker,
9
- User,
10
- } from ".";
11
- import type { Client } from "../Client";
12
- import { Endpoints, type File } from "../rest";
13
- import type {
14
- JSONActionRow,
15
- JSONAllowedMentions,
16
- JSONAttachment,
17
- JSONChannelMention,
18
- JSONEmbed,
19
- JSONMessage,
20
- JSONMessageActivity,
21
- JSONMessageCreateEventExtraFields,
22
- JSONMessageInteraction,
23
- JSONMessageReference,
24
- JSONReaction,
25
- JSONResolvedData,
26
- JSONRoleSubscriptionData,
27
- JSONStickerItem,
28
- RawChannel,
29
- RawMessage,
30
- RawMessageCreateEventExtraFields,
31
- RawUser,
32
- } from "../types";
33
- import { MessageFlags, MessageTypes } from "../constants";
34
-
35
- /** https://discord.com/developers/docs/resources/channel */
36
- export class Message extends Base {
37
- protected override raw: RawMessage &
38
- Partial<RawMessageCreateEventExtraFields>;
39
- channelId: string;
40
- author: User;
41
- content: string;
42
- timestamp: string;
43
- editedTimestamp: string | null;
44
- tts: boolean;
45
- mentionEveryone: boolean;
46
- mentions: Array<User>;
47
- mentionRoles: Array<string>;
48
- mentionChannels?: Array<JSONChannelMention>;
49
- attachments: Array<JSONAttachment>;
50
- embeds: Array<JSONEmbed>;
51
- reactions?: Array<JSONReaction>;
52
- nonce?: number | string;
53
- pinned: boolean;
54
- webhookId?: string;
55
- type: MessageTypes;
56
- activity?: JSONMessageActivity;
57
- application?: Application;
58
- applicationId?: string;
59
- messageReference?: JSONMessageReference;
60
- flags?: MessageFlags;
61
- referencedMessage?: Message | null;
62
- interaction?: JSONMessageInteraction;
63
- thread?: Channel;
64
- components?: Array<JSONActionRow>;
65
- stickerItems?: Array<JSONStickerItem>;
66
- stickers?: Array<Sticker>;
67
- position?: number;
68
- roleSubscriptionData?: JSONRoleSubscriptionData;
69
- resolved?: JSONResolvedData;
70
- guildId?: string;
71
- member?: GuildMember;
72
-
73
- constructor(
74
- data: RawMessage & Partial<RawMessageCreateEventExtraFields>,
75
- client: Client
76
- ) {
77
- super(data.id, client);
78
-
79
- this.raw = data;
80
- this.channelId = data.channel_id;
81
- this.author = new User(data.author, this.client);
82
- this.content = data.content;
83
- this.timestamp = data.timestamp;
84
- this.editedTimestamp =
85
- data.edited_timestamp !== null ? data.edited_timestamp : null;
86
- this.mentions = data.mentions.map((user) => new User(user, this.client));
87
- this.mentionRoles = data.mention_roles;
88
- this.attachments = data.attachments.map((attachment) =>
89
- this.client.util.attachmentToJSON(attachment)
90
- );
91
- this.embeds = this.client.util.embedsToJSON(data.embeds);
92
- this.tts = data.tts;
93
- this.mentionEveryone = data.mention_everyone;
94
- this.pinned = data.pinned;
95
- this.type = data.type;
96
-
97
- this.patch(data);
98
- }
99
-
100
- protected override patch(
101
- data: RawMessage & Partial<RawMessageCreateEventExtraFields>
102
- ): void {
103
- if (data.mention_channels !== undefined)
104
- this.mentionChannels = data.mention_channels.map((mentionChannel) => ({
105
- id: mentionChannel.id,
106
- guildId: mentionChannel.guild_id,
107
- type: mentionChannel.type,
108
- name: mentionChannel.name,
109
- }));
110
- if (data.reactions !== undefined)
111
- this.reactions = data.reactions.map((reaction) => ({
112
- count: reaction.count,
113
- countDetails: reaction.count_details,
114
- me: reaction.me,
115
- meBurst: reaction.me_burst,
116
- emoji: new Emoji(reaction.emoji, this.client).toJSON(),
117
- burstColors: reaction.burst_colors,
118
- }));
119
- if (data.nonce !== undefined) this.nonce = data.nonce;
120
- if (data.webhook_id !== undefined) this.webhookId = data.webhook_id;
121
- if (data.activity !== undefined) this.activity = data.activity;
122
- if (data.application !== undefined)
123
- this.application = new Application(data.application, this.client);
124
- if (data.application_id !== undefined)
125
- this.applicationId = data.application_id;
126
- if (data.message_reference !== undefined)
127
- this.messageReference = {
128
- messageId: data.message_reference.message_id,
129
- channelId: data.message_reference.channel_id,
130
- guildId: data.message_reference.guild_id,
131
- failIfNotExists: data.message_reference.fail_if_not_exists,
132
- };
133
- if (data.flags !== undefined) this.flags = data.flags;
134
- if (data.referenced_message !== undefined)
135
- this.referencedMessage =
136
- data.referenced_message !== null
137
- ? new Message(data.referenced_message, this.client)
138
- : null;
139
- if (data.interaction !== undefined)
140
- this.interaction = {
141
- id: data.interaction.id,
142
- type: data.interaction.type,
143
- name: data.interaction.name,
144
- user: new User(data.interaction.user, this.client),
145
- member:
146
- data.interaction.member !== undefined
147
- ? new GuildMember(data.interaction.member, this.client)
148
- : undefined,
149
- };
150
- if (data.thread !== undefined)
151
- this.thread = new Channel(data.thread, this.client);
152
- if (data.components !== undefined)
153
- this.components = this.client.util.messageComponentsToJSON(
154
- data.components
155
- );
156
- if (data.sticker_items !== undefined)
157
- this.stickerItems = data.sticker_items.map((stickerItem) => ({
158
- id: stickerItem.id,
159
- name: stickerItem.name,
160
- formatType: stickerItem.format_type,
161
- }));
162
- if (data.stickers !== undefined)
163
- this.stickers = data.stickers.map(
164
- (sticker) => new Sticker(sticker, this.client)
165
- );
166
- if (data.position !== undefined) this.position = data.position;
167
- if (data.role_subscription_data !== undefined)
168
- this.roleSubscriptionData = {
169
- roleSubscriptionListingId:
170
- data.role_subscription_data.role_subscription_listing_id,
171
- tierName: data.role_subscription_data.tier_name,
172
- totalMonthsSubscribed:
173
- data.role_subscription_data.total_months_subscribed,
174
- isRenewal: data.role_subscription_data.is_renewal,
175
- };
176
- if (data.resolved !== undefined)
177
- this.resolved = {
178
- users:
179
- data.resolved?.users !== undefined
180
- ? new Map(
181
- Object.entries(data.resolved.users).map(([id, user]) => [
182
- id,
183
- new User(user, this.client).toJSON(),
184
- ])
185
- )
186
- : undefined,
187
- members:
188
- data.resolved?.members !== undefined
189
- ? new Map(
190
- Object.entries(data.resolved.members).map(([id, member]) => [
191
- id,
192
- new GuildMember(member, this.client).toJSON(),
193
- ])
194
- )
195
- : undefined,
196
- roles:
197
- data.resolved?.roles !== undefined
198
- ? new Map(
199
- Object.entries(data.resolved.roles).map(([id, role]) => [
200
- id,
201
- new Role(role, this.client).toJSON(),
202
- ])
203
- )
204
- : undefined,
205
- channels:
206
- data.resolved?.channels !== undefined
207
- ? new Map(
208
- Object.entries(data.resolved.channels).map(([id, channel]) => [
209
- id,
210
- new Channel(channel, this.client).toJSON(),
211
- ])
212
- )
213
- : undefined,
214
- messages:
215
- data.resolved?.messages !== undefined
216
- ? new Map(
217
- Object.entries(data.resolved.messages).map(([id, message]) => [
218
- id,
219
- new Message(message, this.client).toJSON(),
220
- ])
221
- )
222
- : undefined,
223
- attachments:
224
- data.resolved?.attachments !== undefined
225
- ? new Map(
226
- Object.entries(data.resolved.attachments).map(
227
- ([id, attachment]) => [
228
- id,
229
- this.client.util.attachmentToJSON(attachment),
230
- ]
231
- )
232
- )
233
- : undefined,
234
- };
235
- if (data.guild_id !== undefined) this.guildId = data.guild_id;
236
- if (data.member !== undefined)
237
- this.member = new GuildMember(data.member, this.client);
238
- }
239
-
240
- /** https://discord.com/developers/docs/resources/channel#create-reaction */
241
- createReaction(emoji: string): void {
242
- this.client.rest.put(
243
- Endpoints.channelMessageReaction(this.channelId, this.id, emoji)
244
- );
245
- }
246
-
247
- /** https://discord.com/developers/docs/resources/channel#start-thread-from-message */
248
- async createThread(
249
- options: {
250
- name: string;
251
- autoArchiveDuration?: number;
252
- rateLimitPerUser?: number | null;
253
- },
254
- reason?: string
255
- ): Promise<Channel> {
256
- return new Channel(
257
- await this.client.rest.post<RawChannel>(
258
- Endpoints.threads(this.channelId, this.id),
259
- {
260
- json: {
261
- name: options.name,
262
- auto_archive_duration: options.autoArchiveDuration,
263
- rate_limit_per_user: options.rateLimitPerUser,
264
- },
265
- reason,
266
- }
267
- ),
268
- this.client
269
- );
270
- }
271
-
272
- /** https://discord.com/developers/docs/resources/channel#crosspost-message */
273
- async crosspost(): Promise<Message> {
274
- return new Message(
275
- await this.client.rest.post<RawMessage>(
276
- Endpoints.channelMessageCrosspost(this.channelId, this.id)
277
- ),
278
- this.client
279
- );
280
- }
281
-
282
- /** https://discord.com/developers/docs/resources/channel#delete-message */
283
- delete(reason?: string): void {
284
- this.client.rest.delete(Endpoints.channelMessage(this.channelId, this.id), {
285
- reason,
286
- });
287
- }
288
-
289
- /** https://discord.com/developers/docs/resources/channel#delete-all-reactions */
290
- deleteAllReactions(emoji?: string): void {
291
- this.client.rest.delete(
292
- Endpoints.channelMessageAllReactions(this.channelId, this.id, emoji)
293
- );
294
- }
295
-
296
- /**
297
- * https://discord.com/developers/docs/resources/channel#delete-own-reaction
298
- * https://discord.com/developers/docs/resources/channel#delete-user-reaction
299
- */
300
- deleteReaction(emoji: string, userId?: string): void {
301
- this.client.rest.delete(
302
- Endpoints.channelMessageReaction(this.channelId, this.id, emoji, userId)
303
- );
304
- }
305
-
306
- /** https://discord.com/developers/docs/resources/channel#edit-message */
307
- async edit(options: {
308
- content?: string | null;
309
- embeds?: Array<JSONEmbed> | null;
310
- flags?: MessageFlags | null;
311
- allowedMentions?: JSONAllowedMentions | null;
312
- components?: Array<JSONActionRow> | null;
313
- files?: Array<File> | null;
314
- attachments?: Array<JSONAttachment> | null;
315
- }): Promise<Message> {
316
- return new Message(
317
- await this.client.rest.patch<RawMessage>(
318
- Endpoints.channelMessage(this.channelId, this.id),
319
- {
320
- json: {
321
- content: options.content,
322
- embeds:
323
- options.embeds !== undefined
324
- ? options.embeds !== null
325
- ? this.client.util.embedsToRaw(options.embeds)
326
- : null
327
- : undefined,
328
- allowed_mentions: options.allowedMentions,
329
- components:
330
- options.components !== undefined
331
- ? options.components !== null
332
- ? this.client.util.messageComponentsToRaw(options.components)
333
- : null
334
- : undefined,
335
- attachments: options.attachments,
336
- flags: options.flags,
337
- },
338
- files: options.files,
339
- }
340
- ),
341
- this.client
342
- );
343
- }
344
-
345
- /** https://discord.com/developers/docs/resources/channel#get-reactions */
346
- async getReactions(
347
- emoji: string,
348
- options?: {
349
- after?: string;
350
- limit?: number;
351
- }
352
- ): Promise<Array<User>> {
353
- return this.client.rest
354
- .get<Array<RawUser>>(
355
- Endpoints.channelMessageAllReactions(this.channelId, this.id, emoji),
356
- {
357
- query: {
358
- after: options?.after,
359
- limit: options?.limit,
360
- },
361
- }
362
- )
363
- .then((response) => response.map((data) => new User(data, this.client)));
364
- }
365
-
366
- /** https://discord.com/developers/docs/resources/channel#pin-message */
367
- pin(reason?: string): void {
368
- this.client.rest.put(Endpoints.channelPin(this.channelId, this.id), {
369
- reason,
370
- });
371
- }
372
-
373
- /** https://discord.com/developers/docs/resources/channel#unpin-message */
374
- unpin(reason?: string): void {
375
- this.client.rest.delete(Endpoints.channelPin(this.channelId, this.id), {
376
- reason,
377
- });
378
- }
379
-
380
- override toRaw(): RawMessage & Partial<RawMessageCreateEventExtraFields> {
381
- return this.raw;
382
- }
383
-
384
- override toJSON(): JSONMessage & Partial<JSONMessageCreateEventExtraFields> {
385
- return {
386
- ...super.toJSON(),
387
- channelId: this.channelId,
388
- author: this.author.toJSON(),
389
- content: this.content,
390
- timestamp: this.timestamp,
391
- editedTimestamp: this.editedTimestamp,
392
- tts: this.tts,
393
- mentionEveryone: this.mentionEveryone,
394
- mentions: this.mentions,
395
- mentionRoles: this.mentionRoles,
396
- mentionChannels: this.mentionChannels,
397
- attachments: this.attachments,
398
- embeds: this.embeds,
399
- reactions: this.reactions,
400
- nonce: this.nonce,
401
- pinned: this.pinned,
402
- webhookId: this.webhookId,
403
- type: this.type,
404
- activity: this.activity,
405
- application: this.application?.toJSON(),
406
- applicationId: this.applicationId,
407
- messageReference: this.messageReference,
408
- flags: this.flags,
409
- referencedMessage: this.referencedMessage?.toJSON(),
410
- interaction: this.interaction,
411
- thread: this.thread,
412
- components: this.components,
413
- stickerItems: this.stickerItems,
414
- stickers: this.stickers,
415
- position: this.position,
416
- roleSubscriptionData: this.roleSubscriptionData,
417
- guildId: this.guildId,
418
- member: this.member?.toJSON(),
419
- };
420
- }
421
- }
@@ -1,116 +0,0 @@
1
- import type { Client } from "../Client";
2
- import { Endpoints } from "../rest";
3
- import type { JSONRole, JSONRoleTags, RawRole } from "../types";
4
- import { Base } from ".";
5
- import { RoleFlags } from "../constants";
6
-
7
- /** https://discord.com/developers/docs/topics/permissions */
8
- export class Role extends Base {
9
- protected override raw: RawRole;
10
- name: string;
11
- color: number;
12
- hoist: boolean;
13
- icon?: string | null;
14
- unicodeEmoji?: string | null;
15
- position: number;
16
- permissions: string;
17
- managed: boolean;
18
- mentionable: boolean;
19
- tags?: JSONRoleTags;
20
- flags: RoleFlags;
21
-
22
- constructor(data: RawRole, client: Client) {
23
- super(data.id, client);
24
-
25
- this.raw = data;
26
- this.name = data.name;
27
- this.color = data.color;
28
- this.hoist = data.hoist;
29
- this.position = data.position;
30
- this.permissions = data.permissions;
31
- this.managed = data.managed;
32
- this.mentionable = data.mentionable;
33
- this.flags = data.flags;
34
-
35
- this.patch(data);
36
- }
37
-
38
- protected override patch(data: RawRole): void {
39
- if (data.icon !== undefined) this.icon = data.icon;
40
- if (data.unicode_emoji !== undefined)
41
- this.unicodeEmoji = data.unicode_emoji;
42
- if (data.tags !== undefined)
43
- this.tags = {
44
- botId: data.tags.bot_id,
45
- integrationId: data.tags.integration_id,
46
- premiumSubscriber: data.tags.premium_subscriber,
47
- subscriptionListingId: data.tags.subscription_listing_id,
48
- availableForPurchase: data.tags.available_for_purchase,
49
- guildConnections: data.tags.guild_connections,
50
- };
51
- }
52
-
53
- /** https://discord.com/developers/docs/resources/guild#delete-guild-role */
54
- delete(guildId: string, reason?: string): void {
55
- this.client.rest.delete(Endpoints.guildRole(guildId, this.id), {
56
- reason,
57
- });
58
- }
59
-
60
- /** https://discord.com/developers/docs/resources/guild#modify-guild-role */
61
- async edit(
62
- guildId: string,
63
- options?: {
64
- name?: string | null;
65
- permissions?: string | null;
66
- color?: number | null;
67
- hoist?: boolean | null;
68
- icon?: string | null;
69
- unicodeEmoji?: string | null;
70
- mentionable?: boolean | null;
71
- },
72
- reason?: string
73
- ): Promise<Role> {
74
- return new Role(
75
- await this.client.rest.patch<RawRole>(
76
- Endpoints.guildRole(guildId, this.id),
77
- {
78
- json: {
79
- name: options?.name,
80
- permissions: options?.permissions,
81
- color: options?.color,
82
- hoist: options?.hoist,
83
- icon: options?.icon,
84
- unicode_emoji: options?.unicodeEmoji,
85
- mentionable: options?.mentionable,
86
- },
87
- reason,
88
- }
89
- ),
90
- this.client
91
- );
92
- }
93
-
94
- override toRaw(): RawRole & {
95
- guild_id?: string;
96
- } {
97
- return this.raw;
98
- }
99
-
100
- override toJSON(): JSONRole {
101
- return {
102
- ...super.toJSON(),
103
- name: this.name,
104
- color: this.color,
105
- hoist: this.hoist,
106
- icon: this.icon,
107
- unicodeEmoji: this.unicodeEmoji,
108
- position: this.position,
109
- permissions: this.permissions,
110
- managed: this.managed,
111
- mentionable: this.mentionable,
112
- tags: this.tags,
113
- flags: this.flags,
114
- };
115
- }
116
- }
@@ -1,63 +0,0 @@
1
- import type { Client } from "../Client";
2
- import type { JSONSKU, RawSKU } from "../types";
3
- import { Base } from ".";
4
- import type { SKUFlags, SKUTypes } from "../constants";
5
-
6
- /** https://discord.com/developers/docs/monetization/skus */
7
- export class SKU extends Base {
8
- protected override raw: RawSKU;
9
- type: SKUTypes;
10
- dependentSKUId?: string | null; // Undocumented
11
- applicationId: string;
12
- manifestLabels?: null; // Undocumented
13
- accessType?: number; // Undocumented
14
- name: string;
15
- features?: []; // Undocumented
16
- releaseDate?: null; // Undocumented
17
- slug: string;
18
- flags: SKUFlags;
19
- showAgeGate?: boolean; // Undocumented
20
-
21
- constructor(data: RawSKU, client: Client) {
22
- super(data.id, client);
23
-
24
- this.raw = data;
25
- this.type = data.type;
26
- this.applicationId = data.application_id;
27
- this.name = data.name;
28
- this.slug = data.slug;
29
- this.flags = data.flags;
30
- }
31
-
32
- protected override patch(data: RawSKU): void {
33
- if (data.dependent_sku_id !== undefined)
34
- this.dependentSKUId = data.dependent_sku_id;
35
- if (data.manifest_labels !== undefined)
36
- this.manifestLabels = data.manifest_labels;
37
- if (data.access_type !== undefined) this.accessType = data.access_type;
38
- if (data.features !== undefined) this.features = data.features;
39
- if (data.release_date !== undefined) this.releaseDate = data.release_date;
40
- if (data.show_age_gate !== undefined) this.showAgeGate = data.show_age_gate;
41
- }
42
-
43
- override toRaw(): RawSKU {
44
- return this.raw;
45
- }
46
-
47
- override toJSON(): JSONSKU {
48
- return {
49
- id: this.id,
50
- type: this.type,
51
- dependentSKUId: this.dependentSKUId,
52
- applicationId: this.applicationId,
53
- manifestLabels: this.manifestLabels,
54
- accessType: this.accessType,
55
- name: this.name,
56
- features: this.features,
57
- releaseDate: this.releaseDate,
58
- slug: this.slug,
59
- flags: this.flags,
60
- showAgeGate: this.showAgeGate,
61
- };
62
- }
63
- }
@@ -1,74 +0,0 @@
1
- import type { Client } from "../Client";
2
- import { Endpoints } from "../rest";
3
- import type { JSONStageInstance, RawStageInstance } from "../types";
4
- import type { PrivacyLevel } from "../constants";
5
- import { Base } from ".";
6
-
7
- /** https://discord.com/developers/docs/resources/stage-instance */
8
- export class StageInstance extends Base {
9
- protected override raw: RawStageInstance;
10
- guildId: string;
11
- channelId: string;
12
- topic: string;
13
- privacyLevel: PrivacyLevel;
14
- discoverableDisabled: boolean;
15
- guildScheduledEventId: string | null;
16
-
17
- constructor(data: RawStageInstance, client: Client) {
18
- super(data.id, client);
19
-
20
- this.raw = data;
21
- this.guildId = data.guild_id;
22
- this.channelId = data.channel_id;
23
- this.topic = data.topic;
24
- this.privacyLevel = data.privacy_level;
25
- this.discoverableDisabled = data.discoverable_disabled;
26
- this.guildScheduledEventId = data.guild_scheduled_event_id;
27
- }
28
-
29
- /** https://discord.com/developers/docs/resources/stage-instance#delete-stage-instance */
30
- delete(reason?: string): void {
31
- this.client.rest.delete(Endpoints.stageInstance(this.channelId), {
32
- reason,
33
- });
34
- }
35
-
36
- /** https://discord.com/developers/docs/resources/stage-instance#modify-stage-instance */
37
- async edit(
38
- options: {
39
- topic?: string;
40
- privacyLevel?: PrivacyLevel;
41
- },
42
- reason?: string
43
- ): Promise<StageInstance> {
44
- return new StageInstance(
45
- await this.client.rest.patch<RawStageInstance>(
46
- Endpoints.stageInstance(this.channelId),
47
- {
48
- json: {
49
- topic: options.topic,
50
- privacy_level: options.privacyLevel,
51
- },
52
- reason,
53
- }
54
- ),
55
- this.client
56
- );
57
- }
58
-
59
- override toRaw(): RawStageInstance {
60
- return this.raw;
61
- }
62
-
63
- override toJSON(): JSONStageInstance {
64
- return {
65
- ...super.toJSON(),
66
- guildId: this.guildId,
67
- channelId: this.channelId,
68
- topic: this.topic,
69
- privacyLevel: this.privacyLevel,
70
- discoverableDisabled: this.discoverableDisabled,
71
- guildScheduledEventId: this.guildScheduledEventId,
72
- };
73
- }
74
- }