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/Client.ts DELETED
@@ -1,616 +0,0 @@
1
- import {
2
- type DefaultMessageNotificationLevel,
3
- type ExplicitContentFilterLevel,
4
- GatewayIntents,
5
- type OAuth2Scopes,
6
- type PrivacyLevel,
7
- StatusTypes,
8
- type SystemChannelFlags,
9
- type VerificationLevel,
10
- GatewayOPCodes,
11
- ChannelTypes,
12
- } from "./constants";
13
- import { Util } from "./utils";
14
- import { Endpoints, REST } from "./rest";
15
- import {
16
- Application,
17
- AutoModerationRule,
18
- Channel,
19
- Guild,
20
- GuildMember,
21
- GuildScheduledEvent,
22
- Integration,
23
- Interaction,
24
- Invite,
25
- Message,
26
- StageInstance,
27
- User,
28
- VoiceState,
29
- ClientApplication,
30
- Emoji,
31
- Sticker,
32
- Role,
33
- UnavailableGuild,
34
- Entitlement,
35
- } from "./structures";
36
- import type {
37
- Activity,
38
- JSONAuditLogEntry,
39
- AutoModerationActionExecutionEventFields,
40
- JSONAutoModerationRule,
41
- JSONChannel,
42
- ChannelPinsUpdateEventFields,
43
- JSONGuildApplicationCommandPermissions,
44
- GuildBanAddEventFields,
45
- GuildBanRemoveEventFields,
46
- GuildMemberRemoveEventFields,
47
- GuildMemberUpdateEventFields,
48
- GuildMembersChunkEventFields,
49
- JSONGuildScheduledEvent,
50
- IntegrationDeleteEventFields,
51
- InviteCreateEventFields,
52
- InviteDeleteEventFields,
53
- MessageDeleteBulkEventFields,
54
- MessageDeleteEventFields,
55
- MessageReactionAddEventFields,
56
- MessageReactionRemoveAllEventFields,
57
- MessageReactionRemoveEmojiEventFields,
58
- MessageReactionRemoveEventFields,
59
- PresenceUpdateEventFields,
60
- JSONRole,
61
- JSONStageInstance,
62
- JSONStickerPack,
63
- ThreadListSyncEventFields,
64
- JSONThreadMember,
65
- ThreadMembersUpdateEventFields,
66
- TypingStartEventFields,
67
- JSONVoiceRegion,
68
- VoiceServerUpdateEventFields,
69
- RawApplication,
70
- RawChannel,
71
- RawGuild,
72
- RawInvite,
73
- RawStageInstance,
74
- RawStickerPack,
75
- RawUser,
76
- RawVoiceRegion,
77
- JSONEntitlement,
78
- JSONUnavailableGuild,
79
- } from "./types";
80
- import EventEmitter from "node:events";
81
- import { Shard, ShardsManager } from "./gateway";
82
-
83
- export interface ClientEvents {
84
- hello: [];
85
- ready: [];
86
- resumed: [];
87
- reconnect: [];
88
- invalidSession: [];
89
- applicationCommandPermissionsUpdate: [
90
- applicationCommandPermissions: JSONGuildApplicationCommandPermissions
91
- ];
92
- autoModerationRuleCreate: [autoModerationRule: AutoModerationRule];
93
- autoModerationRuleUpdate: [autoModerationRule: AutoModerationRule];
94
- autoModerationRuleDelete: [autoModerationRule: JSONAutoModerationRule];
95
- autoModerationActionExecution: [
96
- autoModerationExecution: AutoModerationActionExecutionEventFields
97
- ];
98
- channelCreate: [channel: Channel];
99
- channelUpdate: [channel: Channel];
100
- channelDelete: [channel: JSONChannel];
101
- channelPinsUpdate: [pins: ChannelPinsUpdateEventFields];
102
- threadCreate: [thread: Channel];
103
- threadUpdate: [thread: Channel];
104
- threadDelete: [thread: JSONChannel];
105
- threadListSync: [sync: ThreadListSyncEventFields];
106
- threadMemberUpdate: [
107
- threadMember: JSONThreadMember & {
108
- guildId: string;
109
- }
110
- ];
111
- threadMembersUpdate: [thread: ThreadMembersUpdateEventFields];
112
- entitlementCreate: [entitlement: Entitlement];
113
- entitlementUpdate: [entitlement: Entitlement];
114
- entitlementDelete: [entitlement: JSONEntitlement];
115
- guildCreate: [guild: Guild | UnavailableGuild];
116
- guildUpdate: [guild: Guild];
117
- guildDelete: [guild: JSONUnavailableGuild];
118
- guildAuditLogEntryCreate: [auditLogEntry: JSONAuditLogEntry];
119
- guildBanAdd: [ban: GuildBanAddEventFields];
120
- guildBanRemove: [ban: GuildBanRemoveEventFields];
121
- guildEmojisUpdate: [emojis: Array<Emoji>, guildId: string];
122
- guildStickersUpdate: [stickers: Array<Sticker>, guildId: string];
123
- guildIntegrationsUpdate: [guildId: string];
124
- guildMemberAdd: [guildMember: GuildMember];
125
- guildMemberRemove: [guildMember: GuildMemberRemoveEventFields];
126
- guildMemberUpdate: [guildMember: GuildMemberUpdateEventFields];
127
- guildMembersChunk: [request: GuildMembersChunkEventFields];
128
- guildRoleCreate: [role: Role, guildId: string];
129
- guildRoleUpdate: [role: Role, guildId: string];
130
- guildRoleDelete: [roleId: string, guildId: string];
131
- guildScheduledEventCreate: [guildScheduledEvent: GuildScheduledEvent];
132
- guildScheduledEventUpdate: [guildScheduledEvent: GuildScheduledEvent];
133
- guildScheduledEventDelete: [guildScheduledEvent: JSONGuildScheduledEvent];
134
- guildScheduledEventUserAdd: [
135
- userId: string,
136
- guildScheduledEventId: string,
137
- guildId: string
138
- ];
139
- guildScheduledEventUserRemove: [
140
- userId: string,
141
- guildScheduledEventId: string,
142
- guildId: string
143
- ];
144
- integrationCreate: [integration: Integration];
145
- integrationUpdate: [integration: Integration];
146
- integrationDelete: [integration: IntegrationDeleteEventFields];
147
- interactionCreate: [interaction: Interaction];
148
- inviteCreate: [invite: InviteCreateEventFields];
149
- inviteDelete: [invite: InviteDeleteEventFields];
150
- messageCreate: [message: Message];
151
- messageUpdate: [
152
- message:
153
- | Message
154
- | {
155
- id: string;
156
- channelId: string;
157
- }
158
- ];
159
- messageDelete: [message: MessageDeleteEventFields];
160
- messageDeleteBulk: [bulk: MessageDeleteBulkEventFields];
161
- messageReactionAdd: [reaction: MessageReactionAddEventFields];
162
- messageReactionRemove: [reaction: MessageReactionRemoveEventFields];
163
- messageReactionRemoveAll: [reaction: MessageReactionRemoveAllEventFields];
164
- messageReactionRemoveEmoji: [reaction: MessageReactionRemoveEmojiEventFields];
165
- presenceUpdate: [presence: PresenceUpdateEventFields];
166
- stageInstanceCreate: [stageInstance: StageInstance];
167
- stageInstanceUpdate: [stageInstance: StageInstance];
168
- stageInstanceDelete: [stageInstance: JSONStageInstance];
169
- typingStart: [typing: TypingStartEventFields];
170
- userUpdate: [user: User];
171
- voiceStateUpdate: [voiceState: VoiceState];
172
- voiceServerUpdate: [voiceServer: VoiceServerUpdateEventFields];
173
- webhooksUpdate: [channelId: string, guildId: string];
174
- }
175
-
176
- export interface ClientOptions {
177
- intents?: number | Array<number>;
178
- shardsCount?: number | "auto";
179
- auth?: "Bot" | "Bearer";
180
- }
181
-
182
- export class Client extends EventEmitter {
183
- token: string;
184
- intents: GatewayIntents | number;
185
- shardsCount: number | "auto";
186
- auth: "Bot" | "Bearer";
187
- shards: ShardsManager;
188
- rest: REST;
189
- util: Util;
190
- user!: User;
191
- application!: ClientApplication;
192
- guildSharding: Record<string, number>;
193
-
194
- constructor(token: string, options?: ClientOptions) {
195
- super();
196
-
197
- this.token = token;
198
- this.intents =
199
- options?.intents !== undefined
200
- ? Array.isArray(options.intents)
201
- ? options.intents.reduce((sum, num) => sum + num, 0)
202
- : options.intents
203
- : GatewayIntents.AllNonPrivileged;
204
- this.shardsCount = options?.shardsCount ?? "auto";
205
- this.auth = options?.auth ?? "Bot";
206
- this.shards = new ShardsManager();
207
- this.rest = new REST(token, this.auth);
208
- this.util = new Util();
209
- this.guildSharding = {};
210
- }
211
-
212
- /** https://discord.com/developers/docs/resources/guild#create-guild */
213
- async createGuild(options: {
214
- name: string;
215
- region?: string | null;
216
- icon?: string;
217
- verificationLevel?: VerificationLevel;
218
- defaultMessageNotifications?: DefaultMessageNotificationLevel;
219
- explicitContentFilter?: ExplicitContentFilterLevel;
220
- roles?: Array<
221
- Partial<Omit<JSONRole, "id" | "position" | "tags" | "flags" | "managed">>
222
- >;
223
- channels?: Array<{
224
- name: string;
225
- type: ChannelTypes;
226
- id?: number;
227
- parentId?: number;
228
- }>;
229
- afkChannelId?: string;
230
- afkTimeout?: number;
231
- systemChannelId?: string;
232
- systemChannelFlags?: SystemChannelFlags;
233
- }): Promise<Guild> {
234
- return new Guild(
235
- await this.rest.post<RawGuild>(Endpoints.guilds(), {
236
- json: {
237
- name: options.name,
238
- region: options.region,
239
- icon: options.icon,
240
- verification_level: options.verificationLevel,
241
- default_message_notifications: options.defaultMessageNotifications,
242
- explicit_content_filter: options.explicitContentFilter,
243
- roles: options.roles?.map((role) => this.util.roleToRaw(role)),
244
- channels: options.channels?.map((channel) => ({
245
- id: channel.id,
246
- type: channel.name,
247
- parent_id: channel.parentId,
248
- name: channel.name,
249
- })),
250
- afk_channel_id: options.afkChannelId,
251
- afk_timeout: options.afkTimeout,
252
- system_channel_id: options.systemChannelId,
253
- system_channel_flags: options.systemChannelFlags,
254
- },
255
- }),
256
- this
257
- );
258
- }
259
-
260
- /** https://discord.com/developers/docs/resources/guild-template#create-guild-from-guild-template */
261
- async createGuildFromTemplate(
262
- code: string,
263
- options: {
264
- name: string;
265
- icon?: string;
266
- }
267
- ): Promise<Guild> {
268
- return new Guild(
269
- await this.rest.post<RawGuild>(Endpoints.template(code), {
270
- json: {
271
- name: options.name,
272
- icon: options.icon,
273
- },
274
- }),
275
- this
276
- );
277
- }
278
-
279
- /** https://discord.com/developers/docs/resources/stage-instance#create-stage-instance */
280
- async createStageInstance(
281
- options: {
282
- channelId: string;
283
- topic: string;
284
- privacyLevel?: PrivacyLevel;
285
- sendStartNotifications?: boolean;
286
- guildScheduledEventId?: string;
287
- },
288
- reason?: string
289
- ): Promise<StageInstance> {
290
- return new StageInstance(
291
- await this.rest.post<RawStageInstance>(Endpoints.stageInstances(), {
292
- json: {
293
- channel_id: options.channelId,
294
- topic: options.topic,
295
- privacy_level: options.privacyLevel,
296
- send_start_notifications: options.sendStartNotifications,
297
- guild_scheduled_event_id: options.guildScheduledEventId,
298
- },
299
- reason,
300
- }),
301
- this
302
- );
303
- }
304
-
305
- /** https://discord.com/developers/docs/resources/application#get-current-application */
306
- async getApplication(): Promise<Application> {
307
- return new Application(
308
- await this.rest.get<RawApplication>(Endpoints.applicationCurrentUser()),
309
- this
310
- );
311
- }
312
-
313
- /** https://discord.com/developers/docs/resources/channel#get-channel */
314
- async getChannel(channelId: string): Promise<Channel> {
315
- return new Channel(
316
- await this.rest.get<RawChannel>(Endpoints.channel(channelId)),
317
- this
318
- );
319
- }
320
-
321
- /** https://discord.com/developers/docs/topics/gateway#get-gateway */
322
- async getGateway(): Promise<{ url: string }> {
323
- return this.rest.get<{ url: string }>(Endpoints.gateway());
324
- }
325
-
326
- /** https://discord.com/developers/docs/topics/gateway#get-gateway-bot */
327
- async getGatewayBot(): Promise<{
328
- url: string;
329
- shards: number;
330
- sessionStartLimit: {
331
- total: number;
332
- remaining: number;
333
- resetAfter: number;
334
- maxConcurrency: number;
335
- };
336
- }> {
337
- return this.rest
338
- .get<{
339
- url: string;
340
- shards: number;
341
- session_start_limit: {
342
- total: number;
343
- remaining: number;
344
- reset_after: number;
345
- max_concurrency: number;
346
- };
347
- }>(Endpoints.gatewayBot())
348
- .then((response) => ({
349
- url: response.url,
350
- shards: response.shards,
351
- sessionStartLimit: {
352
- total: response.session_start_limit.total,
353
- remaining: response.session_start_limit.remaining,
354
- resetAfter: response.session_start_limit.reset_after,
355
- maxConcurrency: response.session_start_limit.max_concurrency,
356
- },
357
- }));
358
- }
359
-
360
- /** https://discord.com/developers/docs/resources/guild#get-guild */
361
- async getGuild(
362
- guildId: string,
363
- options?: {
364
- withCounts?: boolean;
365
- }
366
- ): Promise<Guild> {
367
- return new Guild(
368
- await this.rest.get<RawGuild>(Endpoints.guild(guildId), {
369
- query: {
370
- with_counts: options?.withCounts,
371
- },
372
- }),
373
- this
374
- );
375
- }
376
-
377
- /** https://discord.com/developers/docs/resources/user#get-current-user-guilds */
378
- async getGuilds(options?: {
379
- before?: string;
380
- after?: string;
381
- limit?: number;
382
- withCounts?: boolean;
383
- }): Promise<Array<Guild>> {
384
- return this.rest
385
- .get<Array<RawGuild>>(Endpoints.userGuilds(), {
386
- query: {
387
- before: options?.before,
388
- after: options?.after,
389
- limit: options?.limit,
390
- with_counts: options?.withCounts,
391
- },
392
- })
393
- .then((response) => response.map((data) => new Guild(data, this)));
394
- }
395
-
396
- /** https://discord.com/developers/docs/resources/invite#get-invite */
397
- async getInvite(
398
- code: string,
399
- options?: {
400
- withCounts?: boolean;
401
- withExpiration?: boolean;
402
- guildScheduledEventId?: string;
403
- }
404
- ): Promise<Invite> {
405
- return new Invite(
406
- await this.rest.get<RawInvite>(Endpoints.invite(code), {
407
- query: {
408
- with_counts: options?.withCounts,
409
- with_expiration: options?.withExpiration,
410
- guild_scheduled_event_id: options?.guildScheduledEventId,
411
- },
412
- }),
413
- this
414
- );
415
- }
416
-
417
- /** https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information */
418
- async getOAuth2Application(): Promise<Application> {
419
- return new Application(
420
- await this.rest.get<RawApplication>(Endpoints.oauth2CurrentApplication()),
421
- this
422
- );
423
- }
424
-
425
- /** https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information */
426
- async getOAuth2Authorization(): Promise<{
427
- application: Application;
428
- scopes: Array<OAuth2Scopes>;
429
- expires: string;
430
- user?: User;
431
- }> {
432
- return this.rest
433
- .get<{
434
- application: RawApplication;
435
- scopes: Array<OAuth2Scopes>;
436
- expires: string;
437
- user?: RawUser;
438
- }>(Endpoints.oauth2Authorization())
439
- .then((response) => ({
440
- application: new Application(response.application, this),
441
- scopes: response.scopes,
442
- expires: response.expires,
443
- user:
444
- response.user !== undefined
445
- ? new User(response.user, this)
446
- : undefined,
447
- }));
448
- }
449
-
450
- /** https://discord.com/developers/docs/resources/stage-instance#get-stage-instance */
451
- async getStageInstance(channelId: string): Promise<StageInstance> {
452
- return new StageInstance(
453
- await this.rest.get<RawStageInstance>(Endpoints.stageInstance(channelId)),
454
- this
455
- );
456
- }
457
-
458
- /** https://discord.com/developers/docs/resources/sticker#list-sticker-packs */
459
- async getStickerPacks(): Promise<{
460
- stickerPacks: Array<JSONStickerPack>;
461
- }> {
462
- return this.rest
463
- .get<{
464
- sticker_packs: Array<RawStickerPack>;
465
- }>(Endpoints.stickerPacks())
466
- .then((response) => ({
467
- stickerPacks: response.sticker_packs.map((stickerPack) => ({
468
- id: stickerPack.id,
469
- stickers: stickerPack.stickers.map((sticker) => ({
470
- id: sticker.id,
471
- packId: sticker.pack_id,
472
- name: sticker.name,
473
- description: sticker.description,
474
- tags: sticker.tags,
475
- asset: sticker.asset,
476
- type: sticker.type,
477
- formatType: sticker.format_type,
478
- available: sticker.available,
479
- guildId: sticker.guild_id,
480
- user:
481
- sticker.user !== undefined
482
- ? new User(sticker.user, this).toJSON()
483
- : undefined,
484
- sortValue: sticker.sort_value,
485
- })),
486
- name: stickerPack.name,
487
- skuId: stickerPack.sku_id,
488
- coverStickerId: stickerPack.cover_sticker_id,
489
- description: stickerPack.description,
490
- bannerAssetId: stickerPack.banner_asset_id,
491
- })),
492
- }));
493
- }
494
-
495
- /** https://discord.com/developers/docs/resources/user#get-user */
496
- async getUser(userId?: string): Promise<User> {
497
- return new User(await this.rest.get<RawUser>(Endpoints.user(userId)), this);
498
- }
499
-
500
- /** https://discord.com/developers/docs/resources/voice#list-voice-regions */
501
- async getVoiceRegions(): Promise<Array<JSONVoiceRegion>> {
502
- return this.rest
503
- .get<Array<RawVoiceRegion>>(Endpoints.voiceRegions())
504
- .then((response) =>
505
- response.map((data) => ({
506
- id: data.id,
507
- name: data.name,
508
- optimal: data.optimal,
509
- deprecated: data.deprecated,
510
- custom: data.custom,
511
- }))
512
- );
513
- }
514
-
515
- /** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
516
- joinVoiceChannel(
517
- guildId: string,
518
- channelId: string,
519
- options?: {
520
- selfMute?: boolean;
521
- selfDeaf?: boolean;
522
- }
523
- ): void {
524
- this.shards.get(this.guildSharding[guildId])?.ws.send(
525
- JSON.stringify({
526
- op: GatewayOPCodes.VoiceStateUpdate,
527
- d: {
528
- guild_id: guildId,
529
- channel_id: channelId,
530
- self_mute: !!options?.selfMute,
531
- self_deaf: !!options?.selfDeaf,
532
- },
533
- })
534
- );
535
- }
536
-
537
- /** https://discord.com/developers/docs/topics/gateway-events#update-voice-state */
538
- leaveVoiceChannel(guildId: string): void {
539
- this.shards.get(this.guildSharding[guildId])?.ws.send(
540
- JSON.stringify({
541
- op: GatewayOPCodes.VoiceStateUpdate,
542
- d: {
543
- guild_id: guildId,
544
- channel_id: null,
545
- self_mute: false,
546
- self_deaf: false,
547
- },
548
- })
549
- );
550
- }
551
-
552
- /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
553
- setPresence(options: {
554
- activity?: Pick<Activity, "name" | "type" | "url" | "state">;
555
- status?: StatusTypes;
556
- afk?: boolean;
557
- }): void {
558
- for (const [id, shard] of this.shards) shard.setPresence(options);
559
- }
560
-
561
- /** https://discord.com/developers/docs/topics/gateway#connections */
562
- async connect(): Promise<void> {
563
- this.shardsCount =
564
- this.shardsCount === "auto"
565
- ? (await this.getGatewayBot()).shards
566
- : this.shardsCount;
567
-
568
- for (let i = 0; i < this.shardsCount; i++)
569
- this.shards.set(i, new Shard(i, this));
570
-
571
- this.shards.connect();
572
- }
573
-
574
- disconnect(): void {
575
- this.shards.disconnect();
576
- }
577
- }
578
-
579
- export declare interface Client extends EventEmitter {
580
- addListener<K extends keyof ClientEvents>(
581
- eventName: K,
582
- listener: (...args: ClientEvents[K]) => void
583
- ): this;
584
- emit<K extends keyof ClientEvents>(
585
- eventName: K,
586
- ...args: ClientEvents[K]
587
- ): boolean;
588
- listenerCount(eventName: keyof ClientEvents): number;
589
- listeners(eventName: keyof ClientEvents): Array<Function>;
590
- off<K extends keyof ClientEvents>(
591
- eventName: K,
592
- listener: (...args: ClientEvents[K]) => void
593
- ): this;
594
- on<K extends keyof ClientEvents>(
595
- eventName: K,
596
- listener: (...args: ClientEvents[K]) => void
597
- ): this;
598
- once<K extends keyof ClientEvents>(
599
- eventName: K,
600
- listener: (...args: ClientEvents[K]) => void
601
- ): this;
602
- prependListener<K extends keyof ClientEvents>(
603
- eventName: K,
604
- listener: (...args: ClientEvents[K]) => void
605
- ): this;
606
- prependOnceListener<K extends keyof ClientEvents>(
607
- eventName: K,
608
- listener: (...args: ClientEvents[K]) => void
609
- ): this;
610
- rawListeners(eventName: keyof ClientEvents): Array<Function>;
611
- removeAllListeners(event?: keyof ClientEvents): this;
612
- removeListener<K extends keyof ClientEvents>(
613
- eventName: K,
614
- listener: (...args: ClientEvents[K]) => void
615
- ): this;
616
- }