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,341 +0,0 @@
1
- import { Base, Channel, Guild, Message, User } from ".";
2
- import type { Client } from "../Client";
3
- import { Endpoints, type File } from "../rest";
4
- import type {
5
- JSONActionRow,
6
- JSONAllowedMentions,
7
- JSONAttachment,
8
- JSONEmbed,
9
- JSONWebhook,
10
- RawMessage,
11
- RawWebhook,
12
- } from "../types";
13
- import type { MessageFlags, WebhookTypes } from "../constants";
14
-
15
- /** https://discord.com/developers/docs/resources/webhook */
16
- export class Webhook extends Base {
17
- protected override raw: RawWebhook;
18
- type: WebhookTypes;
19
- guildId?: string | null;
20
- channelId: string | null;
21
- user?: User;
22
- name: string | null;
23
- avatar: string | null;
24
- token?: string;
25
- applicationId: string | null;
26
- sourceGuild?: Guild;
27
- sourceChannel?: Channel;
28
- url?: string;
29
-
30
- constructor(data: RawWebhook, client: Client) {
31
- super(data.id, client);
32
-
33
- this.raw = data;
34
- this.type = data.type;
35
- this.channelId = data.channel_id;
36
- this.name = data.name;
37
- this.avatar = data.avatar;
38
- this.applicationId = data.application_id;
39
-
40
- this.patch(data);
41
- }
42
-
43
- protected override patch(data: RawWebhook): void {
44
- if (data.guild_id !== undefined) this.guildId = data.guild_id;
45
- if (data.user !== undefined) this.user = new User(data.user, this.client);
46
- if (data.token !== undefined) this.token = data.token;
47
- if (data.source_guild !== undefined)
48
- this.sourceGuild = new Guild(data.source_guild, this.client);
49
- if (data.source_channel !== undefined)
50
- this.sourceChannel = new Channel(data.source_channel, this.client);
51
- if (data.url !== undefined) this.url = data.url;
52
- }
53
-
54
- /** https://discord.com/developers/docs/resources/webhook#delete-webhook */
55
- delete(reason?: string): void {
56
- this.client.rest.delete(Endpoints.webhook(this.id), {
57
- reason,
58
- });
59
- }
60
-
61
- /** https://discord.com/developers/docs/resources/webhook#delete-webhook-message */
62
- deleteMessage(
63
- messageId: string,
64
- options?: {
65
- threadId?: string;
66
- }
67
- ): void {
68
- if (!this.token) throw new Error("[disgroove] Webhook token not found");
69
-
70
- this.client.rest.delete(
71
- Endpoints.webhookMessage(this.id, this.token, messageId),
72
- {
73
- query: {
74
- thread_id: options?.threadId,
75
- },
76
- }
77
- );
78
- }
79
-
80
- /** https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token */
81
- deleteWithToken(reason?: string): void {
82
- if (!this.token) throw new Error("[disgroove] Webhook token not found");
83
-
84
- this.client.rest.delete(Endpoints.webhook(this.id, this.token), {
85
- reason,
86
- authorization: false,
87
- });
88
- }
89
-
90
- /** https://discord.com/developers/docs/resources/webhook#modify-webhook */
91
- async edit(
92
- options: {
93
- name?: string;
94
- avatar?: string | null;
95
- channelId?: string;
96
- },
97
- reason?: string
98
- ): Promise<Webhook> {
99
- return new Webhook(
100
- await this.client.rest.patch<RawWebhook>(Endpoints.webhook(this.id), {
101
- json: {
102
- name: options.name,
103
- avatar: options.avatar,
104
- channel_id: options.channelId,
105
- },
106
- reason,
107
- }),
108
- this.client
109
- );
110
- }
111
-
112
- /** https://discord.com/developers/docs/resources/webhook#edit-webhook-message */
113
- async editMessage(
114
- messageId: string,
115
- options: {
116
- threadId?: string;
117
- content?: string | null;
118
- embeds?: Array<JSONEmbed> | null;
119
- flags?: MessageFlags | null;
120
- allowedMentions?: JSONAllowedMentions | null;
121
- components?: Array<JSONActionRow> | null;
122
- files?: Array<File> | null;
123
- attachments?: Array<JSONAttachment> | null;
124
- }
125
- ): Promise<Message> {
126
- if (!this.token) throw new Error("[disgroove] Webhook token not found");
127
-
128
- return new Message(
129
- await this.client.rest.patch<RawMessage>(
130
- Endpoints.webhookMessage(this.id, this.token, messageId),
131
- {
132
- json: {
133
- content: options.content,
134
- embeds:
135
- options.embeds !== undefined
136
- ? options.embeds !== null
137
- ? this.client.util.embedsToRaw(options.embeds)
138
- : null
139
- : undefined,
140
- allowed_mentions: {
141
- parse: options.allowedMentions?.parse,
142
- roles: options.allowedMentions?.roles,
143
- users: options.allowedMentions?.users,
144
- replied_user: options.allowedMentions?.repliedUser,
145
- },
146
- components:
147
- options.components !== undefined
148
- ? options.components !== null
149
- ? this.client.util.messageComponentsToRaw(options.components)
150
- : null
151
- : undefined,
152
- attachments: options.attachments,
153
- flags: options.flags,
154
- },
155
- files: options.files,
156
- query: {
157
- thread_id: options.threadId,
158
- },
159
- }
160
- ),
161
- this.client
162
- );
163
- }
164
-
165
- /** https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token */
166
- async editWithToken(
167
- options: {
168
- name?: string;
169
- avatar?: string | null;
170
- },
171
- reason?: string
172
- ): Promise<Webhook> {
173
- if (!this.token) throw new Error("[disgroove] Webhook token not found");
174
-
175
- return new Webhook(
176
- await this.client.rest.patch<RawWebhook>(
177
- Endpoints.webhook(this.id, this.token),
178
- {
179
- json: {
180
- name: options.name,
181
- avatar: options.avatar,
182
- },
183
- reason,
184
- authorization: false,
185
- }
186
- ),
187
- this.client
188
- );
189
- }
190
-
191
- /** https://discord.com/developers/docs/resources/webhook#execute-webhook */
192
- async execute(options: {
193
- wait?: boolean;
194
- threadId?: string;
195
- content?: string | null;
196
- username?: string;
197
- avatarURL?: string;
198
- tts?: boolean;
199
- embeds?: Array<JSONEmbed> | null;
200
- allowedMentions?: JSONAllowedMentions | null;
201
- components?: Array<JSONActionRow> | null;
202
- files?: Array<File> | null;
203
- attachments?: Array<JSONAttachment> | null;
204
- flags?: MessageFlags | null;
205
- threadName?: string;
206
- }): Promise<Message | null> {
207
- if (!this.token) throw new Error("[disgroove] Webhook token not found");
208
-
209
- return this.client.rest
210
- .post<RawMessage | null>(Endpoints.webhook(this.id, this.token), {
211
- json: {
212
- content: options.content,
213
- tts: options.tts,
214
- embeds:
215
- options.embeds !== undefined
216
- ? options.embeds !== null
217
- ? this.client.util.embedsToRaw(options.embeds)
218
- : null
219
- : undefined,
220
- allowed_mentions: {
221
- parse: options.allowedMentions?.parse,
222
- roles: options.allowedMentions?.roles,
223
- users: options.allowedMentions?.users,
224
- replied_user: options.allowedMentions?.repliedUser,
225
- },
226
- components:
227
- options.components !== undefined
228
- ? options.components !== null
229
- ? this.client.util.messageComponentsToRaw(options.components)
230
- : null
231
- : undefined,
232
- attachments: options.attachments,
233
- flags: options.flags,
234
- thread_name: options.threadName,
235
- },
236
- files: options.files,
237
- query: {
238
- wait: options.wait,
239
- thread_id: options.threadId,
240
- username: options.username,
241
- avatarURL: options.avatarURL,
242
- },
243
- })
244
- .then((response) => {
245
- if (response !== null) {
246
- return new Message(response, this.client);
247
- } else return null;
248
- });
249
- }
250
-
251
- /** https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook */
252
- async executeGitHubCompatible(options: {
253
- threadId?: string;
254
- wait?: boolean;
255
- }): Promise<Message | null> {
256
- if (!this.token) throw new Error("[disgroove] Webhook token not found");
257
-
258
- return this.client.rest
259
- .post<RawMessage | null>(
260
- Endpoints.webhookPlatform(this.id, this.token, "github"),
261
- {
262
- query: {
263
- thread_id: options.threadId,
264
- wait: options.wait,
265
- },
266
- }
267
- )
268
- .then((response) => {
269
- if (response !== null) {
270
- return new Message(response, this.client);
271
- } else return null;
272
- });
273
- }
274
-
275
- /** https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook */
276
- async executeSlackCompatible(options: {
277
- threadId?: string;
278
- wait?: boolean;
279
- }): Promise<Message | null> {
280
- if (!this.token) throw new Error("[disgroove] Webhook token not found");
281
-
282
- return this.client.rest
283
- .post<RawMessage | null>(
284
- Endpoints.webhookPlatform(this.id, this.token, "slack"),
285
- {
286
- query: {
287
- thread_id: options.threadId,
288
- wait: options.wait,
289
- },
290
- }
291
- )
292
- .then((response) => {
293
- if (response !== null) {
294
- return new Message(response, this.client);
295
- } else return null;
296
- });
297
- }
298
-
299
- /** https://discord.com/developers/docs/resources/webhook#get-webhook-message */
300
- async getMessage(
301
- messageId: string,
302
- options?: {
303
- threadId?: string;
304
- }
305
- ): Promise<Message> {
306
- if (!this.token) throw new Error("[disgroove] Webhook token not found");
307
-
308
- return new Message(
309
- await this.client.rest.get<RawMessage>(
310
- Endpoints.webhookMessage(this.id, this.token, messageId),
311
- {
312
- query: {
313
- thread_id: options?.threadId,
314
- },
315
- }
316
- ),
317
- this.client
318
- );
319
- }
320
-
321
- override toRaw(): RawWebhook {
322
- return this.raw;
323
- }
324
-
325
- override toJSON(): JSONWebhook {
326
- return {
327
- ...super.toJSON(),
328
- type: this.type,
329
- guildId: this.guildId,
330
- channelId: this.channelId,
331
- user: this.user?.toJSON(),
332
- name: this.name,
333
- avatar: this.avatar,
334
- token: this.token,
335
- applicationId: this.applicationId,
336
- sourceGuild: this.sourceGuild?.toJSON(),
337
- sourceChannel: this.sourceChannel?.toJSON(),
338
- url: this.url,
339
- };
340
- }
341
- }
@@ -1,27 +0,0 @@
1
- export * from "./Base";
2
- export * from "./Application";
3
- export * from "./ApplicationCommand";
4
- export * from "./AuditLog";
5
- export * from "./AutoModerationRule";
6
- export * from "./Channel";
7
- export * from "./ClientApplication";
8
- export * from "./Emoji";
9
- export * from "./Entitlement";
10
- export * from "./Guild";
11
- export * from "./GuildMember";
12
- export * from "./GuildScheduledEvent";
13
- export * from "./GuildTemplate";
14
- export * from "./Integration";
15
- export * from "./Interaction";
16
- export * from "./Invite";
17
- export * from "./Message";
18
- export * from "./Role";
19
- export * from "./SKU";
20
- export * from "./StageInstance";
21
- export * from "./Sticker";
22
- export * from "./Team";
23
- export * from "./TestEntitlement";
24
- export * from "./UnavailableGuild";
25
- export * from "./User";
26
- export * from "./VoiceState";
27
- export * from "./Webhook";
@@ -1,118 +0,0 @@
1
- import type {
2
- ApplicationCommandTypes,
3
- ApplicationCommandOptionType,
4
- ChannelTypes,
5
- Locale,
6
- ApplicationCommandPermissionType,
7
- } from "../constants";
8
-
9
- /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-structure */
10
- export interface RawApplicationCommand {
11
- id: string;
12
- type?: ApplicationCommandTypes;
13
- application_id: string;
14
- guild_id?: string;
15
- name: string;
16
- name_localizations?: Partial<Record<Locale, string>> | null;
17
- description: string;
18
- description_localizations?: Partial<Record<Locale, string>> | null;
19
- options?: Array<RawApplicationCommandOption>;
20
- default_member_permissions: string | null;
21
- dm_permission?: boolean;
22
- default_permission?: boolean | null;
23
- nsfw?: boolean;
24
- version: string;
25
- }
26
-
27
- /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */
28
- export interface RawApplicationCommandOption {
29
- type: ApplicationCommandOptionType;
30
- name: string;
31
- name_localizations?: Partial<Record<Locale, string>> | null;
32
- description: string;
33
- description_localizations?: Partial<Record<Locale, string>> | null;
34
- required?: boolean;
35
- choices?: Array<RawApplicationCommandOptionChoice>;
36
- options?: Array<RawApplicationCommandOption>;
37
- channel_types?: Array<ChannelTypes>;
38
- min_value?: number;
39
- max_value?: number;
40
- min_length?: number;
41
- max_length?: number;
42
- autocomplete?: boolean;
43
- }
44
-
45
- /** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */
46
- export interface RawApplicationCommandOptionChoice {
47
- name: string;
48
- name_localizations?: Partial<Record<Locale, string>> | null;
49
- value: string;
50
- }
51
-
52
- /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-guild-application-command-permissions-structure */
53
- export interface RawGuildApplicationCommandPermissions {
54
- id: string;
55
- application_id: string;
56
- guild_id: string;
57
- permissions: Array<RawApplicationCommandPermission>;
58
- }
59
-
60
- /** https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permissions-structure */
61
- export interface RawApplicationCommandPermission {
62
- id: string;
63
- type: ApplicationCommandPermissionType;
64
- permission: boolean;
65
- }
66
-
67
- export interface JSONApplicationCommand {
68
- id: string;
69
- type?: ApplicationCommandTypes;
70
- applicationId: string;
71
- guildId?: string;
72
- name: string;
73
- nameLocalizations?: Partial<Record<Locale, string>> | null;
74
- description: string;
75
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
76
- options?: Array<JSONApplicationCommandOption>;
77
- defaultMemberPermissions: string | null;
78
- dmPermission?: boolean;
79
- defaultPermission?: boolean | null;
80
- nsfw?: boolean;
81
- version: string;
82
- }
83
-
84
- export interface JSONApplicationCommandOption {
85
- type: ApplicationCommandOptionType;
86
- name: string;
87
- nameLocalizations?: Partial<Record<Locale, string>> | null;
88
- description: string;
89
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
90
- required?: boolean;
91
- choices?: Array<JSONApplicationCommandOptionChoice>;
92
- options?: Array<JSONApplicationCommandOption>;
93
- channelTypes?: Array<ChannelTypes>;
94
- minValue?: number;
95
- maxValue?: number;
96
- minLength?: number;
97
- maxLength?: number;
98
- autocomplete?: boolean;
99
- }
100
-
101
- export interface JSONApplicationCommandOptionChoice {
102
- name: string;
103
- nameLocalizations?: Partial<Record<Locale, string>> | null;
104
- value: string;
105
- }
106
-
107
- export interface JSONGuildApplicationCommandPermissions {
108
- id: string;
109
- applicationId: string;
110
- guildId: string;
111
- permissions: Array<JSONApplicationCommandPermission>;
112
- }
113
-
114
- export interface JSONApplicationCommandPermission {
115
- id: string;
116
- type: ApplicationCommandPermissionType;
117
- permission: boolean;
118
- }
@@ -1,23 +0,0 @@
1
- import type {
2
- ApplicationRoleConnectionMetadataType,
3
- Locale,
4
- } from "../constants";
5
-
6
- /** https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object-application-role-connection-metadata-structure */
7
- export interface RawApplicationRoleConnectionMetadata {
8
- type: ApplicationRoleConnectionMetadataType;
9
- key: string;
10
- name: string;
11
- name_localizations?: Partial<Record<Locale, string>> | null;
12
- description: string;
13
- description_localizations?: Partial<Record<Locale, string>> | null;
14
- }
15
-
16
- export interface JSONApplicationRoleConnectionMetadata {
17
- type: ApplicationRoleConnectionMetadataType;
18
- key: string;
19
- name: string;
20
- nameLocalizations?: Partial<Record<Locale, string>> | null;
21
- description: string;
22
- descriptionLocalizations?: Partial<Record<Locale, string>> | null;
23
- }
@@ -1,77 +0,0 @@
1
- import type {
2
- RawUser,
3
- RawTeam,
4
- JSONTeam,
5
- JSONUser,
6
- RawGuild,
7
- JSONGuild,
8
- } from ".";
9
- import type { ApplicationFlags, OAuth2Scopes } from "../constants";
10
-
11
- /** https://discord.com/developers/docs/resources/application#application-object-application-structure */
12
- export interface RawApplication {
13
- id: string;
14
- name: string;
15
- icon: string | null;
16
- description: string;
17
- rpc_origins?: Array<string>;
18
- bot_public: boolean;
19
- bot_require_code_grant: boolean;
20
- terms_of_service_url?: string;
21
- privacy_policy_url?: string;
22
- owner?: RawUser;
23
- verify_key: string;
24
- team: RawTeam | null;
25
- guild_id?: string;
26
- guild?: RawGuild;
27
- primary_sku_id?: string;
28
- slug?: string;
29
- cover_image?: string;
30
- flags?: ApplicationFlags;
31
- approximate_guild_count?: number;
32
- redirect_uris?: Array<string>;
33
- interactions_endpoint_url?: string;
34
- role_connections_verification_url?: string;
35
- tags?: Array<string>;
36
- install_params?: RawInstallParams;
37
- custom_install_url?: string;
38
- }
39
-
40
- /** https://discord.com/developers/docs/resources/application#install-params-object-install-params-structure */
41
- export interface RawInstallParams {
42
- scopes: Array<OAuth2Scopes>;
43
- permissions: string;
44
- }
45
-
46
- export interface JSONApplication {
47
- id: string;
48
- name: string;
49
- icon: string | null;
50
- description: string;
51
- rpcOrigins?: Array<string>;
52
- botPublic: boolean;
53
- botRequireCodeGrant: boolean;
54
- termsOfServiceURL?: string;
55
- privacyPolicyURL?: string;
56
- owner?: JSONUser;
57
- verifyKey: string;
58
- team: JSONTeam | null;
59
- guildId?: string;
60
- guild?: JSONGuild;
61
- primarySKUId?: string;
62
- slug?: string;
63
- coverImage?: string;
64
- flags?: ApplicationFlags;
65
- approximateGuildCount?: number;
66
- redirectURIs?: Array<string>;
67
- interactionsEndpointURL?: string;
68
- roleConnectionsVerificationURL?: string;
69
- tags?: Array<string>;
70
- installParams?: JSONInstallParams;
71
- customInstallURL?: string;
72
- }
73
-
74
- export interface JSONInstallParams {
75
- scopes: Array<OAuth2Scopes>;
76
- permissions: string;
77
- }
@@ -1,105 +0,0 @@
1
- import type {
2
- RawApplicationCommand,
3
- RawGuildScheduledEvent,
4
- RawAutoModerationRule,
5
- RawIntegration,
6
- RawChannel,
7
- RawUser,
8
- RawWebhook,
9
- JSONUser,
10
- JSONApplicationCommand,
11
- JSONAutoModerationRule,
12
- JSONGuildScheduledEvent,
13
- JSONIntegration,
14
- JSONChannel,
15
- JSONWebhook,
16
- } from ".";
17
- import type { AuditLogEvents } from "../constants";
18
-
19
- /** https://discord.com/developers/docs/resources/audit-log#audit-log-object-audit-log-structure */
20
- export interface RawAuditLog {
21
- application_commands: Array<RawApplicationCommand>;
22
- audit_log_entries: Array<RawAuditLogEntry>;
23
- auto_moderation_rules: Array<RawAutoModerationRule>;
24
- guild_scheduled_events: Array<RawGuildScheduledEvent>;
25
- integrations: Array<RawIntegration>;
26
- threads: Array<RawChannel>;
27
- users: Array<RawUser>;
28
- webhooks: Array<RawWebhook>;
29
- }
30
-
31
- /** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
32
- export interface RawAuditLogEntry {
33
- target_id: string | null;
34
- changes?: Array<RawAuditLogChange>;
35
- user_id: string | null;
36
- id: string;
37
- action_type: AuditLogEvents;
38
- options?: RawOptionalAuditLogEntryInfo;
39
- reason?: string;
40
- }
41
-
42
- /** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
43
- export interface RawOptionalAuditLogEntryInfo {
44
- application_id: string;
45
- auto_moderation_rule_name: string;
46
- auto_moderation_rule_trigger_type: string;
47
- channel_id: string;
48
- count: string;
49
- delete_member_days: string;
50
- id: string;
51
- members_removed: string;
52
- message_id: string;
53
- role_name: string;
54
- type: string;
55
- integration_type: string;
56
- }
57
-
58
- /** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
59
- export interface RawAuditLogChange {
60
- new_value?: any;
61
- old_value?: any;
62
- key: string;
63
- }
64
-
65
- export interface JSONAuditLog {
66
- applicationCommands: Array<JSONApplicationCommand>;
67
- auditLogEntries: Array<JSONAuditLogEntry>;
68
- autoModerationRules: Array<JSONAutoModerationRule>;
69
- guildScheduledEvents: Array<JSONGuildScheduledEvent>;
70
- integrations: Array<JSONIntegration>;
71
- threads: Array<JSONChannel>;
72
- users: Array<JSONUser>;
73
- webhooks: Array<JSONWebhook>;
74
- }
75
-
76
- export interface JSONAuditLogEntry {
77
- targetId: string | null;
78
- changes?: Array<JSONAuditLogChange>;
79
- userId: string | null;
80
- id: string;
81
- actionType: AuditLogEvents;
82
- options?: JSONOptionalAuditLogEntryInfo;
83
- reason?: string;
84
- }
85
-
86
- export interface JSONOptionalAuditLogEntryInfo {
87
- applicationId: string;
88
- autoModerationRuleName: string;
89
- autoModerationRuleTriggerType: string;
90
- channelId: string;
91
- count: string;
92
- deleteMemberDays: string;
93
- id: string;
94
- membersRemoved: string;
95
- messageId: string;
96
- roleName: string;
97
- type: string;
98
- integrationType: string;
99
- }
100
-
101
- export interface JSONAuditLogChange {
102
- newValue?: any;
103
- oldValue?: any;
104
- key: string;
105
- }