chapterjs 0.1.2 → 0.2.0

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 (318) hide show
  1. package/dist/assets/asset.d.ts +46 -0
  2. package/dist/assets/asset.js +86 -0
  3. package/dist/assets/public.d.ts +19 -0
  4. package/dist/assets/public.js +120 -0
  5. package/dist/cache/cache.d.ts +62 -0
  6. package/dist/cache/cache.js +80 -0
  7. package/dist/cache/store.d.ts +45 -0
  8. package/dist/cache/store.js +53 -0
  9. package/dist/cli/build.d.ts +41 -0
  10. package/dist/cli/build.js +205 -0
  11. package/dist/cli/cli.js +108 -25
  12. package/dist/cli/cluster.d.ts +70 -0
  13. package/dist/cli/cluster.js +213 -0
  14. package/dist/cli/dev.d.ts +18 -1
  15. package/dist/cli/dev.js +253 -198
  16. package/dist/cli/env.d.ts +31 -0
  17. package/dist/cli/env.js +93 -0
  18. package/dist/cli/log.d.ts +13 -0
  19. package/dist/cli/log.js +17 -0
  20. package/dist/cli/node-version.d.ts +8 -0
  21. package/dist/cli/node-version.js +13 -0
  22. package/dist/cli/preflight.d.ts +36 -0
  23. package/dist/cli/preflight.js +122 -0
  24. package/dist/cli/project.d.ts +135 -0
  25. package/dist/cli/project.js +517 -0
  26. package/dist/cli/start.d.ts +25 -0
  27. package/dist/cli/start.js +225 -0
  28. package/dist/commands/autocomplete.d.ts +13 -0
  29. package/dist/commands/autocomplete.js +159 -0
  30. package/dist/commands/command.d.ts +360 -0
  31. package/dist/commands/command.js +28 -0
  32. package/dist/commands/declaration.d.ts +77 -0
  33. package/dist/commands/declaration.js +492 -0
  34. package/dist/commands/register.d.ts +18 -0
  35. package/dist/commands/register.js +42 -0
  36. package/dist/commands/router.d.ts +20 -0
  37. package/dist/commands/router.js +228 -0
  38. package/dist/commands/tree.d.ts +47 -0
  39. package/dist/commands/tree.js +216 -0
  40. package/dist/commands/twins.d.ts +15 -0
  41. package/dist/commands/twins.js +78 -0
  42. package/dist/components/button.d.ts +79 -0
  43. package/dist/components/button.js +106 -0
  44. package/dist/components/component.d.ts +140 -0
  45. package/dist/components/component.js +39 -0
  46. package/dist/components/custom-id.d.ts +72 -0
  47. package/dist/components/custom-id.js +128 -0
  48. package/dist/components/declaration.d.ts +42 -0
  49. package/dist/components/declaration.js +342 -0
  50. package/dist/components/declared.d.ts +29 -0
  51. package/dist/components/declared.js +49 -0
  52. package/dist/components/embed.d.ts +29 -0
  53. package/dist/components/embed.js +11 -0
  54. package/dist/components/instance.d.ts +100 -0
  55. package/dist/components/instance.js +86 -0
  56. package/dist/components/layout.d.ts +103 -0
  57. package/dist/components/layout.js +279 -0
  58. package/dist/components/modal.d.ts +245 -0
  59. package/dist/components/modal.js +398 -0
  60. package/dist/components/options.d.ts +41 -0
  61. package/dist/components/options.js +101 -0
  62. package/dist/components/render.d.ts +12 -0
  63. package/dist/components/render.js +58 -0
  64. package/dist/components/router.d.ts +19 -0
  65. package/dist/components/router.js +251 -0
  66. package/dist/components/select.d.ts +146 -0
  67. package/dist/components/select.js +179 -0
  68. package/dist/core/bot.d.ts +99 -0
  69. package/dist/core/bot.js +174 -0
  70. package/dist/core/memory.d.ts +66 -0
  71. package/dist/core/memory.js +115 -0
  72. package/dist/discord/api.d.ts +112 -0
  73. package/dist/discord/api.js +115 -0
  74. package/dist/discord/cdn.d.ts +67 -0
  75. package/dist/discord/cdn.js +100 -0
  76. package/dist/discord/codes.d.ts +171 -0
  77. package/dist/discord/codes.js +421 -0
  78. package/dist/discord/endpoint.d.ts +56 -0
  79. package/dist/discord/endpoint.js +53 -0
  80. package/dist/discord/endpoints.d.ts +1529 -0
  81. package/dist/discord/endpoints.js +1139 -0
  82. package/dist/discord/formatting.d.ts +67 -0
  83. package/dist/discord/formatting.js +87 -0
  84. package/dist/discord/index.d.ts +10 -0
  85. package/dist/discord/index.js +13 -0
  86. package/dist/discord/intents.d.ts +48 -0
  87. package/dist/discord/intents.js +128 -0
  88. package/dist/discord/permissions.d.ts +94 -0
  89. package/dist/discord/permissions.js +185 -0
  90. package/dist/discord/snowflake.d.ts +21 -0
  91. package/dist/discord/snowflake.js +36 -0
  92. package/dist/discord/types/application-command.d.ts +332 -0
  93. package/dist/discord/types/application-command.js +48 -0
  94. package/dist/discord/types/application-role-connection-metadata.d.ts +42 -0
  95. package/dist/discord/types/application-role-connection-metadata.js +22 -0
  96. package/dist/discord/types/application.d.ts +208 -0
  97. package/dist/discord/types/application.js +48 -0
  98. package/dist/discord/types/audit-log.d.ts +255 -0
  99. package/dist/discord/types/audit-log.js +144 -0
  100. package/dist/discord/types/auto-moderation.d.ts +167 -0
  101. package/dist/discord/types/auto-moderation.js +52 -0
  102. package/dist/discord/types/channel.d.ts +557 -0
  103. package/dist/discord/types/channel.js +88 -0
  104. package/dist/discord/types/common.d.ts +54 -0
  105. package/dist/discord/types/common.js +38 -0
  106. package/dist/discord/types/component.d.ts +775 -0
  107. package/dist/discord/types/component.js +76 -0
  108. package/dist/discord/types/emoji.d.ts +74 -0
  109. package/dist/discord/types/emoji.js +1 -0
  110. package/dist/discord/types/entitlement.d.ts +84 -0
  111. package/dist/discord/types/entitlement.js +22 -0
  112. package/dist/discord/types/gateway-events.d.ts +1148 -0
  113. package/dist/discord/types/gateway-events.js +54 -0
  114. package/dist/discord/types/gateway.d.ts +38 -0
  115. package/dist/discord/types/gateway.js +1 -0
  116. package/dist/discord/types/guild-scheduled-event.d.ts +257 -0
  117. package/dist/discord/types/guild-scheduled-event.js +68 -0
  118. package/dist/discord/types/guild-template.d.ts +51 -0
  119. package/dist/discord/types/guild-template.js +1 -0
  120. package/dist/discord/types/guild.d.ts +910 -0
  121. package/dist/discord/types/guild.js +153 -0
  122. package/dist/discord/types/index.d.ts +31 -0
  123. package/dist/discord/types/index.js +31 -0
  124. package/dist/discord/types/interaction.d.ts +321 -0
  125. package/dist/discord/types/interaction.js +47 -0
  126. package/dist/discord/types/invite.d.ts +158 -0
  127. package/dist/discord/types/invite.js +39 -0
  128. package/dist/discord/types/message.d.ts +834 -0
  129. package/dist/discord/types/message.js +159 -0
  130. package/dist/discord/types/oauth2.d.ts +22 -0
  131. package/dist/discord/types/oauth2.js +1 -0
  132. package/dist/discord/types/permissions.d.ts +183 -0
  133. package/dist/discord/types/permissions.js +118 -0
  134. package/dist/discord/types/poll.d.ts +106 -0
  135. package/dist/discord/types/poll.js +8 -0
  136. package/dist/discord/types/sku.d.ts +47 -0
  137. package/dist/discord/types/sku.js +26 -0
  138. package/dist/discord/types/soundboard.d.ts +71 -0
  139. package/dist/discord/types/soundboard.js +1 -0
  140. package/dist/discord/types/stage-instance.d.ts +58 -0
  141. package/dist/discord/types/stage-instance.js +10 -0
  142. package/dist/discord/types/sticker.d.ts +115 -0
  143. package/dist/discord/types/sticker.js +20 -0
  144. package/dist/discord/types/subscription.d.ts +54 -0
  145. package/dist/discord/types/subscription.js +12 -0
  146. package/dist/discord/types/team.d.ts +55 -0
  147. package/dist/discord/types/team.js +21 -0
  148. package/dist/discord/types/user.d.ts +273 -0
  149. package/dist/discord/types/user.js +83 -0
  150. package/dist/discord/types/voice.d.ts +72 -0
  151. package/dist/discord/types/voice.js +1 -0
  152. package/dist/discord/types/webhook.d.ts +184 -0
  153. package/dist/discord/types/webhook.js +12 -0
  154. package/dist/events/declaration.d.ts +16 -0
  155. package/dist/events/declaration.js +80 -0
  156. package/dist/events/event.d.ts +45 -0
  157. package/dist/events/event.js +34 -0
  158. package/dist/events/registry.d.ts +697 -0
  159. package/dist/events/registry.js +839 -0
  160. package/dist/events/router.d.ts +46 -0
  161. package/dist/events/router.js +133 -0
  162. package/dist/gateway/errors.d.ts +18 -0
  163. package/dist/gateway/errors.js +47 -0
  164. package/dist/gateway/gateway.d.ts +64 -0
  165. package/dist/gateway/gateway.js +117 -0
  166. package/dist/gateway/identify-queue.d.ts +25 -0
  167. package/dist/gateway/identify-queue.js +29 -0
  168. package/dist/gateway/shard.d.ts +94 -0
  169. package/dist/gateway/shard.js +414 -0
  170. package/dist/gateway/state.d.ts +11 -0
  171. package/dist/gateway/state.js +184 -0
  172. package/dist/index.d.ts +57 -18
  173. package/dist/index.js +40 -12
  174. package/dist/interactions/cooldown.d.ts +33 -0
  175. package/dist/interactions/cooldown.js +74 -0
  176. package/dist/interactions/dispatch.d.ts +91 -0
  177. package/dist/interactions/dispatch.js +110 -0
  178. package/dist/loader/generated.d.ts +10 -0
  179. package/dist/loader/generated.js +80 -0
  180. package/dist/loader/hot.d.ts +13 -0
  181. package/dist/loader/hot.js +85 -0
  182. package/dist/loader/loader.d.ts +85 -0
  183. package/dist/loader/loader.js +119 -0
  184. package/dist/loader/locate.d.ts +10 -0
  185. package/dist/loader/locate.js +36 -0
  186. package/dist/loader/watch.d.ts +17 -0
  187. package/dist/loader/watch.js +66 -0
  188. package/dist/main.d.ts +2 -0
  189. package/dist/main.js +5 -0
  190. package/dist/messages/commands.d.ts +23 -0
  191. package/dist/messages/commands.js +142 -0
  192. package/dist/messages/declaration.d.ts +89 -0
  193. package/dist/messages/declaration.js +455 -0
  194. package/dist/messages/messages.d.ts +241 -0
  195. package/dist/messages/messages.js +31 -0
  196. package/dist/messages/phrases.d.ts +23 -0
  197. package/dist/messages/phrases.js +44 -0
  198. package/dist/messages/translate.d.ts +100 -0
  199. package/dist/messages/translate.js +249 -0
  200. package/dist/presence/declaration.d.ts +19 -0
  201. package/dist/presence/declaration.js +118 -0
  202. package/dist/presence/presence.d.ts +57 -0
  203. package/dist/presence/presence.js +27 -0
  204. package/dist/rest/errors.d.ts +55 -0
  205. package/dist/rest/errors.js +92 -0
  206. package/dist/rest/rate-limiter.d.ts +46 -0
  207. package/dist/rest/rate-limiter.js +153 -0
  208. package/dist/rest/rest.d.ts +63 -0
  209. package/dist/rest/rest.js +194 -0
  210. package/dist/structures/base.d.ts +48 -0
  211. package/dist/structures/base.js +84 -0
  212. package/dist/structures/channel.d.ts +380 -0
  213. package/dist/structures/channel.js +627 -0
  214. package/dist/structures/context.d.ts +30 -0
  215. package/dist/structures/context.js +7 -0
  216. package/dist/structures/emoji.d.ts +46 -0
  217. package/dist/structures/emoji.js +65 -0
  218. package/dist/structures/entities.d.ts +62 -0
  219. package/dist/structures/entities.js +226 -0
  220. package/dist/structures/guild.d.ts +348 -0
  221. package/dist/structures/guild.js +466 -0
  222. package/dist/structures/interaction.d.ts +197 -0
  223. package/dist/structures/interaction.js +396 -0
  224. package/dist/structures/invite.d.ts +38 -0
  225. package/dist/structures/invite.js +57 -0
  226. package/dist/structures/known.d.ts +28 -0
  227. package/dist/structures/known.js +58 -0
  228. package/dist/structures/member.d.ts +140 -0
  229. package/dist/structures/member.js +260 -0
  230. package/dist/structures/message.d.ts +197 -0
  231. package/dist/structures/message.js +268 -0
  232. package/dist/structures/payload.d.ts +91 -0
  233. package/dist/structures/payload.js +184 -0
  234. package/dist/structures/role.d.ts +69 -0
  235. package/dist/structures/role.js +112 -0
  236. package/dist/structures/user.d.ts +59 -0
  237. package/dist/structures/user.js +94 -0
  238. package/dist/structures/webhook.d.ts +46 -0
  239. package/dist/structures/webhook.js +79 -0
  240. package/dist/tasks/declaration.d.ts +16 -0
  241. package/dist/tasks/declaration.js +56 -0
  242. package/dist/tasks/schedule.d.ts +54 -0
  243. package/dist/tasks/schedule.js +236 -0
  244. package/dist/tasks/scheduler.d.ts +35 -0
  245. package/dist/tasks/scheduler.js +107 -0
  246. package/dist/tasks/task.d.ts +75 -0
  247. package/dist/tasks/task.js +27 -0
  248. package/dist/util/case.d.ts +13 -0
  249. package/dist/util/case.js +54 -0
  250. package/dist/util/duration.d.ts +8 -0
  251. package/dist/util/duration.js +29 -0
  252. package/dist/util/websocket.d.ts +9 -0
  253. package/dist/util/websocket.js +31 -0
  254. package/dist/voice/connection.d.ts +90 -0
  255. package/dist/voice/connection.js +494 -0
  256. package/dist/voice/dave.d.ts +109 -0
  257. package/dist/voice/dave.js +245 -0
  258. package/dist/voice/opus.d.ts +19 -0
  259. package/dist/voice/opus.js +273 -0
  260. package/dist/voice/session.d.ts +55 -0
  261. package/dist/voice/session.js +405 -0
  262. package/dist/voice/source.d.ts +22 -0
  263. package/dist/voice/source.js +195 -0
  264. package/dist/voice/transport.d.ts +43 -0
  265. package/dist/voice/transport.js +140 -0
  266. package/dist/voice/usage.d.ts +4 -0
  267. package/dist/voice/usage.js +33 -0
  268. package/package.json +26 -7
  269. package/vendor/dave/LICENSE +231 -0
  270. package/vendor/dave/libdave.d.mts +99 -0
  271. package/vendor/dave/libdave.mjs +2 -0
  272. package/vendor/dave/libdave.wasm +0 -0
  273. package/dist/components.d.ts +0 -97
  274. package/dist/components.js +0 -260
  275. package/dist/context.d.ts +0 -72
  276. package/dist/context.js +0 -273
  277. package/dist/discord/client.d.ts +0 -35
  278. package/dist/discord/client.js +0 -66
  279. package/dist/discord/constants.d.ts +0 -49
  280. package/dist/discord/constants.js +0 -61
  281. package/dist/discord/events.d.ts +0 -129
  282. package/dist/discord/events.js +0 -102
  283. package/dist/discord/gateway.d.ts +0 -61
  284. package/dist/discord/gateway.js +0 -320
  285. package/dist/discord/payloads.d.ts +0 -275
  286. package/dist/discord/payloads.js +0 -3
  287. package/dist/discord/presence.d.ts +0 -42
  288. package/dist/discord/presence.js +0 -51
  289. package/dist/discord/rest.d.ts +0 -49
  290. package/dist/discord/rest.js +0 -271
  291. package/dist/discord/types.d.ts +0 -334
  292. package/dist/discord/types.js +0 -4
  293. package/dist/events.d.ts +0 -94
  294. package/dist/events.js +0 -255
  295. package/dist/presence.d.ts +0 -92
  296. package/dist/presence.js +0 -250
  297. package/dist/structures/Channel.d.ts +0 -110
  298. package/dist/structures/Channel.js +0 -171
  299. package/dist/structures/Guild.d.ts +0 -70
  300. package/dist/structures/Guild.js +0 -105
  301. package/dist/structures/Interaction.d.ts +0 -113
  302. package/dist/structures/Interaction.js +0 -274
  303. package/dist/structures/Member.d.ts +0 -70
  304. package/dist/structures/Member.js +0 -124
  305. package/dist/structures/Message.d.ts +0 -87
  306. package/dist/structures/Message.js +0 -182
  307. package/dist/structures/Reaction.d.ts +0 -38
  308. package/dist/structures/Reaction.js +0 -64
  309. package/dist/structures/Role.d.ts +0 -43
  310. package/dist/structures/Role.js +0 -77
  311. package/dist/structures/User.d.ts +0 -41
  312. package/dist/structures/User.js +0 -79
  313. package/dist/structures/utils.d.ts +0 -72
  314. package/dist/structures/utils.js +0 -59
  315. package/dist/utils/errors.d.ts +0 -5
  316. package/dist/utils/errors.js +0 -28
  317. package/dist/utils/modules.d.ts +0 -39
  318. package/dist/utils/modules.js +0 -156
@@ -0,0 +1,697 @@
1
+ import type { CacheLimits } from '../cache/cache.js';
2
+ import type { Snowflake } from '../discord/types/common.js';
3
+ import type { GatewayDispatchEventName, GatewayDispatchEvents } from '../discord/types/gateway-events.js';
4
+ import type { Channel, DMChannel, GuildChannel, GuildTextBasedChannel, TextBasedChannel, ThreadChannel, VoiceChannel } from '../structures/channel.js';
5
+ import type { Context } from '../structures/context.js';
6
+ import type { GuildEmoji } from '../structures/emoji.js';
7
+ import type { AuditLogEntry, Guild, ScheduledEvent, VoiceState } from '../structures/guild.js';
8
+ import type { Invite } from '../structures/invite.js';
9
+ import type { GuildMember } from '../structures/member.js';
10
+ import type { DmMessage, GuildMessage, MemberMessage, Message, PrivateMessage, ReactionEmoji } from '../structures/message.js';
11
+ import type { Role } from '../structures/role.js';
12
+ import type { User, UserPresence } from '../structures/user.js';
13
+ import type { TranslationContext } from '../messages/messages.js';
14
+ /** What your function receives, for each event. */
15
+ export interface EventContexts {
16
+ /** The bot is connected and knows every server it is in. */
17
+ ready: {
18
+ /** The bot itself. */
19
+ user: User;
20
+ /** The servers the bot is in. */
21
+ guilds: ReadonlyMap<Snowflake, Guild>;
22
+ };
23
+ /** A message was sent, in a server or in private. */
24
+ messageCreate: {
25
+ /** The message that was sent. */
26
+ message: Message;
27
+ };
28
+ /** A message was edited. */
29
+ messageUpdate: {
30
+ /** The message, as it is now. */
31
+ message: Message;
32
+ };
33
+ /** A message was deleted. */
34
+ messageDelete: {
35
+ /** The id of the deleted message. */
36
+ messageId: Snowflake;
37
+ /** The id of the channel the message was in. */
38
+ channelId: Snowflake;
39
+ /** The id of the server; `null` for a private message. */
40
+ guildId: Snowflake | null;
41
+ /** The server; `null` for a private message. */
42
+ guild: Guild | null;
43
+ /** The channel, when the bot knows it. */
44
+ channel: TextBasedChannel | null;
45
+ /** The message as it was, when the bot remembered it. */
46
+ message: Message | null;
47
+ };
48
+ /** Someone joined a server. */
49
+ memberJoin: {
50
+ /** The new member. */
51
+ member: GuildMember;
52
+ /** The server they joined. */
53
+ guild: Guild;
54
+ };
55
+ /** Someone left a server, or was kicked or banned. */
56
+ memberLeave: {
57
+ /** The account of who left. */
58
+ user: User;
59
+ /** The server they left. */
60
+ guild: Guild;
61
+ /** The member as it was, when the bot knew it. */
62
+ member: GuildMember | null;
63
+ };
64
+ /** A member changed: nickname, roles, timeout, avatar... */
65
+ memberUpdate: {
66
+ /** The member, as they are now. */
67
+ member: GuildMember;
68
+ /** The server of the member. */
69
+ guild: Guild;
70
+ };
71
+ /** The bot was added to a server. */
72
+ guildJoin: {
73
+ /** The server the bot was added to. */
74
+ guild: Guild;
75
+ };
76
+ /** The bot was removed from a server. */
77
+ guildLeave: {
78
+ /** The server as it was, when the bot was in it. */
79
+ guild: Guild;
80
+ };
81
+ /** A channel was created. */
82
+ channelCreate: {
83
+ /** The new channel or thread. */
84
+ channel: GuildChannel | ThreadChannel | Channel;
85
+ };
86
+ /** A channel changed: name, topic, permissions... */
87
+ channelUpdate: {
88
+ /** The channel or thread, as it is now. */
89
+ channel: GuildChannel | ThreadChannel | Channel;
90
+ };
91
+ /** A channel was deleted. */
92
+ channelDelete: {
93
+ /** The channel or thread as it was. */
94
+ channel: GuildChannel | ThreadChannel | Channel;
95
+ };
96
+ /** A role was created. */
97
+ roleCreate: {
98
+ /** The new role. */
99
+ role: Role;
100
+ /** The server of the role. */
101
+ guild: Guild;
102
+ };
103
+ /** A role changed: name, color, permissions, position... */
104
+ roleUpdate: {
105
+ /** The role, as it is now. */
106
+ role: Role;
107
+ /** The server of the role. */
108
+ guild: Guild;
109
+ };
110
+ /** A role was deleted. */
111
+ roleDelete: {
112
+ /** The id of the deleted role. */
113
+ roleId: Snowflake;
114
+ /** The server the role was in. */
115
+ guild: Guild;
116
+ /** The role as it was. */
117
+ role: Role;
118
+ };
119
+ /** The server changed: name, icon, settings... */
120
+ guildUpdate: {
121
+ /** The server, as it is now. */
122
+ guild: Guild;
123
+ };
124
+ /** Someone was banned from a server. */
125
+ banAdd: {
126
+ /** The account that was banned. */
127
+ user: User;
128
+ /** The server they were banned from. */
129
+ guild: Guild;
130
+ };
131
+ /** A ban was lifted: the person can join the server again. */
132
+ banRemove: {
133
+ /** The account that is no longer banned. */
134
+ user: User;
135
+ /** The server of the ban. */
136
+ guild: Guild;
137
+ };
138
+ /** An emoji was added to a server. */
139
+ emojiCreate: {
140
+ /** The new emoji. */
141
+ emoji: GuildEmoji;
142
+ /** The server of the emoji. */
143
+ guild: Guild;
144
+ };
145
+ /** An emoji of a server changed: its name, or who can use it. */
146
+ emojiUpdate: {
147
+ /** The emoji, as it is now. */
148
+ emoji: GuildEmoji;
149
+ /** The server of the emoji. */
150
+ guild: Guild;
151
+ };
152
+ /** An emoji was removed from a server. */
153
+ emojiDelete: {
154
+ /** The emoji as it was. */
155
+ emoji: GuildEmoji;
156
+ /** The server the emoji was in. */
157
+ guild: Guild;
158
+ };
159
+ /** An invite to a server was created. */
160
+ inviteCreate: {
161
+ /** The new invite. */
162
+ invite: Invite;
163
+ /** The server the invite leads to. */
164
+ guild: Guild;
165
+ /** The channel the invite leads to. */
166
+ channel: GuildChannel;
167
+ };
168
+ /** An invite was deleted, or expired. */
169
+ inviteDelete: {
170
+ /** The code of the invite (`discord.gg/code`). */
171
+ code: string;
172
+ /** The server the invite led to. */
173
+ guild: Guild;
174
+ /** The channel the invite led to. */
175
+ channel: GuildChannel;
176
+ };
177
+ /** Something was added to the audit log of a server. */
178
+ auditLogEntryCreate: {
179
+ /** What was done, by whom, on what. */
180
+ entry: AuditLogEntry;
181
+ /** The server of the audit log. */
182
+ guild: Guild;
183
+ };
184
+ /** Someone added a reaction to a message. */
185
+ reactionAdd: {
186
+ /** The emoji of the reaction. */
187
+ emoji: ReactionEmoji;
188
+ /** Who reacted. */
189
+ user: User;
190
+ /** Who reacted, as a member of the server; `null` in a private message. */
191
+ member: GuildMember | null;
192
+ /** Whether it is a super reaction. */
193
+ burst: boolean;
194
+ /** The id of the message. */
195
+ messageId: Snowflake;
196
+ /** The message, when the bot remembers it. */
197
+ message: Message | null;
198
+ /** The id of who wrote the message, when Discord says it. */
199
+ messageAuthorId: Snowflake | null;
200
+ /** The id of the channel of the message. */
201
+ channelId: Snowflake;
202
+ /** The channel of the message, when the bot knows it. */
203
+ channel: TextBasedChannel | null;
204
+ /** The id of the server; `null` in a private message. */
205
+ guildId: Snowflake | null;
206
+ /** The server; `null` in a private message. */
207
+ guild: Guild | null;
208
+ };
209
+ /** Someone removed their reaction from a message. */
210
+ reactionRemove: {
211
+ /** The emoji of the reaction. */
212
+ emoji: ReactionEmoji;
213
+ /** Who had reacted. */
214
+ user: User;
215
+ /** Who had reacted, as a member of the server, when the bot remembers it. */
216
+ member: GuildMember | null;
217
+ /** Whether it was a super reaction. */
218
+ burst: boolean;
219
+ /** The id of the message. */
220
+ messageId: Snowflake;
221
+ /** The message, when the bot remembers it. */
222
+ message: Message | null;
223
+ /** The id of the channel of the message. */
224
+ channelId: Snowflake;
225
+ /** The channel of the message, when the bot knows it. */
226
+ channel: TextBasedChannel | null;
227
+ /** The id of the server; `null` in a private message. */
228
+ guildId: Snowflake | null;
229
+ /** The server; `null` in a private message. */
230
+ guild: Guild | null;
231
+ };
232
+ /** The reactions of a message were removed: all of them, or every reaction of one emoji. */
233
+ reactionClear: {
234
+ /** The emoji whose reactions were removed; `null` when all were. */
235
+ emoji: ReactionEmoji | null;
236
+ /** The id of the message. */
237
+ messageId: Snowflake;
238
+ /** The message, when the bot remembers it. */
239
+ message: Message | null;
240
+ /** The id of the channel of the message. */
241
+ channelId: Snowflake;
242
+ /** The channel of the message, when the bot knows it. */
243
+ channel: TextBasedChannel | null;
244
+ /** The id of the server; `null` in a private message. */
245
+ guildId: Snowflake | null;
246
+ /** The server; `null` in a private message. */
247
+ guild: Guild | null;
248
+ };
249
+ /** Someone voted in a poll. */
250
+ pollVoteAdd: {
251
+ /** The id Discord gave to the answer they voted for: today, its position in the poll, `1` for the first answer. */
252
+ answerId: number;
253
+ /** Who voted. */
254
+ user: User;
255
+ /** Who voted, as a member of the server, when the bot remembers it. */
256
+ member: GuildMember | null;
257
+ /** The id of the message of the poll. */
258
+ messageId: Snowflake;
259
+ /** The message of the poll, when the bot remembers it. */
260
+ message: Message | null;
261
+ /** The id of the channel of the poll. */
262
+ channelId: Snowflake;
263
+ /** The channel of the poll, when the bot knows it. */
264
+ channel: TextBasedChannel | null;
265
+ /** The id of the server; `null` in a private message. */
266
+ guildId: Snowflake | null;
267
+ /** The server; `null` in a private message. */
268
+ guild: Guild | null;
269
+ };
270
+ /** Someone took back their vote in a poll. */
271
+ pollVoteRemove: {
272
+ /** The id Discord gave to the answer they no longer vote for: today, its position in the poll, `1` for the first answer. */
273
+ answerId: number;
274
+ /** Who had voted. */
275
+ user: User;
276
+ /** Who had voted, as a member of the server, when the bot remembers it. */
277
+ member: GuildMember | null;
278
+ /** The id of the message of the poll. */
279
+ messageId: Snowflake;
280
+ /** The message of the poll, when the bot remembers it. */
281
+ message: Message | null;
282
+ /** The id of the channel of the poll. */
283
+ channelId: Snowflake;
284
+ /** The channel of the poll, when the bot knows it. */
285
+ channel: TextBasedChannel | null;
286
+ /** The id of the server; `null` in a private message. */
287
+ guildId: Snowflake | null;
288
+ /** The server; `null` in a private message. */
289
+ guild: Guild | null;
290
+ };
291
+ /** Someone started typing in a channel. */
292
+ typingStart: {
293
+ /** Who is typing. */
294
+ user: User;
295
+ /** Who is typing, as a member of the server; `null` in a private message. */
296
+ member: GuildMember | null;
297
+ /** When they started. */
298
+ startedAt: Date;
299
+ /** The id of the channel. */
300
+ channelId: Snowflake;
301
+ /** The channel, when the bot knows it. */
302
+ channel: TextBasedChannel | null;
303
+ /** The id of the server; `null` in a private message. */
304
+ guildId: Snowflake | null;
305
+ /** The server; `null` in a private message. */
306
+ guild: Guild | null;
307
+ };
308
+ /** Someone was added to a thread, or joined it. */
309
+ threadMemberJoin: {
310
+ /** The thread. */
311
+ thread: ThreadChannel;
312
+ /** Who was added, as a member of the server. */
313
+ member: GuildMember;
314
+ /** The account of who was added. */
315
+ user: User;
316
+ /** The server of the thread. */
317
+ guild: Guild;
318
+ };
319
+ /** Someone was removed from a thread, or left it. */
320
+ threadMemberLeave: {
321
+ /** The thread. */
322
+ thread: ThreadChannel;
323
+ /** The id of who was removed. */
324
+ userId: Snowflake;
325
+ /** The account of who was removed, when the bot knows it. */
326
+ user: User | null;
327
+ /** Who was removed, as a member of the server, when the bot remembers it. */
328
+ member: GuildMember | null;
329
+ /** The server of the thread. */
330
+ guild: Guild;
331
+ };
332
+ /** Someone joined a voice channel. */
333
+ voiceJoin: {
334
+ /** Who joined. */
335
+ member: GuildMember;
336
+ /** The channel they joined. */
337
+ channel: VoiceChannel;
338
+ /** Their voice state: muted, deafened, streaming... */
339
+ voice: VoiceState;
340
+ /** The server of the channel. */
341
+ guild: Guild;
342
+ };
343
+ /** Someone left a voice channel, or was disconnected. */
344
+ voiceLeave: {
345
+ /** Who left. */
346
+ member: GuildMember;
347
+ /** The channel they left. */
348
+ channel: VoiceChannel;
349
+ /** Their voice state as it was, in that channel. */
350
+ voice: VoiceState;
351
+ /** The server of the channel. */
352
+ guild: Guild;
353
+ };
354
+ /** Someone went from one voice channel to another, or was moved. */
355
+ voiceMove: {
356
+ /** Who moved. */
357
+ member: GuildMember;
358
+ /** The channel they left. */
359
+ from: VoiceChannel;
360
+ /** The channel they are in now. */
361
+ to: VoiceChannel;
362
+ /** Their voice state, as it is now. */
363
+ voice: VoiceState;
364
+ /** The server of the channels. */
365
+ guild: Guild;
366
+ };
367
+ /** Someone in a voice channel changed: muted, deafened, started a stream or a camera... */
368
+ voiceUpdate: {
369
+ /** Who changed. */
370
+ member: GuildMember;
371
+ /** The channel they are in. */
372
+ channel: VoiceChannel;
373
+ /** Their voice state, as it is now. */
374
+ voice: VoiceState;
375
+ /** Their voice state as it was. */
376
+ before: VoiceState;
377
+ /** The server of the channel. */
378
+ guild: Guild;
379
+ };
380
+ /** Someone's status or activity changed: online, idle, playing a game... */
381
+ presenceUpdate: {
382
+ /** The id of whose presence changed. */
383
+ userId: Snowflake;
384
+ /** The account of whose presence changed, when the bot knows it. */
385
+ user: User | null;
386
+ /** Whose presence changed, as a member of the server, when the bot remembers it. */
387
+ member: GuildMember | null;
388
+ /** Their status, activities and devices, as they are now. */
389
+ presence: UserPresence;
390
+ /** The server the change is seen from. */
391
+ guild: Guild;
392
+ };
393
+ /** An event was scheduled in a server. */
394
+ scheduledEventCreate: {
395
+ /** The new scheduled event. */
396
+ scheduledEvent: ScheduledEvent;
397
+ /** The server of the scheduled event. */
398
+ guild: Guild;
399
+ };
400
+ /** A scheduled event changed: its time, its place, or it started or ended. */
401
+ scheduledEventUpdate: {
402
+ /** The scheduled event, as it is now. */
403
+ scheduledEvent: ScheduledEvent;
404
+ /** The server of the scheduled event. */
405
+ guild: Guild;
406
+ };
407
+ /** A scheduled event was deleted. */
408
+ scheduledEventDelete: {
409
+ /** The scheduled event as it was. */
410
+ scheduledEvent: ScheduledEvent;
411
+ /** The server the scheduled event was in. */
412
+ guild: Guild;
413
+ };
414
+ /** Someone said they are interested in a scheduled event. */
415
+ scheduledEventUserAdd: {
416
+ /** The id of the scheduled event. */
417
+ scheduledEventId: Snowflake;
418
+ /** Who is interested. */
419
+ user: User;
420
+ /** Who is interested, as a member of the server, when the bot remembers it. */
421
+ member: GuildMember | null;
422
+ /** The server of the scheduled event. */
423
+ guild: Guild;
424
+ };
425
+ /** Someone is no longer interested in a scheduled event. */
426
+ scheduledEventUserRemove: {
427
+ /** The id of the scheduled event. */
428
+ scheduledEventId: Snowflake;
429
+ /** Who is no longer interested. */
430
+ user: User;
431
+ /** Who is no longer interested, as a member of the server, when the bot remembers it. */
432
+ member: GuildMember | null;
433
+ /** The server of the scheduled event. */
434
+ guild: Guild;
435
+ };
436
+ }
437
+ /** The name of an event: the name of a folder of `src/events/`. */
438
+ export type EventName = keyof EventContexts;
439
+ /**
440
+ * Where something happens: in servers (`'guild'`), in private messages with
441
+ * the bot (`'dm'`), or in both.
442
+ */
443
+ export type EventWhere = 'guild' | 'dm' | 'both';
444
+ /** The option of the events that also happen in private messages. */
445
+ export interface WhereEventOptions {
446
+ /**
447
+ * Where the file listens: `'guild'` (in servers, the default), `'dm'` (in
448
+ * private messages with the bot) or `'both'`. What the function receives
449
+ * follows it: a server that is always there, never there, or to check.
450
+ */
451
+ where?: EventWhere;
452
+ }
453
+ /** Options of the events about messages. */
454
+ export interface MessageEventOptions extends WhereEventOptions {
455
+ /**
456
+ * Also run for messages written by bots (this one included) and by
457
+ * webhooks. By default they are ignored: a bot that answers bots can end
458
+ * up answering itself, or another bot, forever.
459
+ */
460
+ bots?: boolean;
461
+ }
462
+ /**
463
+ * The options a file can give to `event()` as its second argument, for the
464
+ * events that have some.
465
+ */
466
+ /** Options of the events about reactions added or removed. */
467
+ export interface ReactionEventOptions extends WhereEventOptions {
468
+ /**
469
+ * Also run for the reactions of bots, this one included. By default they
470
+ * are ignored: a bot that reacts to reactions can end up answering its
471
+ * own, forever.
472
+ */
473
+ bots?: boolean;
474
+ }
475
+ export interface EventOptions {
476
+ messageCreate: MessageEventOptions;
477
+ messageUpdate: MessageEventOptions;
478
+ messageDelete: WhereEventOptions;
479
+ reactionAdd: ReactionEventOptions;
480
+ reactionRemove: ReactionEventOptions;
481
+ reactionClear: WhereEventOptions;
482
+ pollVoteAdd: WhereEventOptions;
483
+ pollVoteRemove: WhereEventOptions;
484
+ typingStart: WhereEventOptions;
485
+ }
486
+ /**
487
+ * Whether a file turned an option on, from the type of what it passed. An
488
+ * option that is only known to be a boolean counts: it may be on.
489
+ */
490
+ type IsOn<Options, Key extends string> = Key extends keyof Options ? Exclude<Options[Key], undefined> extends false ? false : true : false;
491
+ /**
492
+ * Where a file listens, from the type of what it passed: in servers when
493
+ * it says nothing, every place it may be when it is only known to be one.
494
+ */
495
+ type WhereOf<Options> = 'where' extends keyof Options ? [Exclude<Options['where'], undefined>] extends [never] ? 'guild' : Exclude<Options['where'], undefined> : 'guild';
496
+ /** A message of a server: its author is a member unless bots are let in. */
497
+ type ServerMessage<Options> = IsOn<Options, 'bots'> extends true ? GuildMessage : MemberMessage;
498
+ /** The message a file receives: what its options let through. */
499
+ type MessageFor<Options, Where = WhereOf<Options>> = Where extends 'guild' ? ServerMessage<Options> : Where extends 'dm' ? DmMessage : ServerMessage<Options> | PrivateMessage;
500
+ type Deleted = Omit<EventContexts['messageDelete'], 'guildId' | 'guild' | 'channel' | 'message'>;
501
+ /** A message deleted in a server. */
502
+ interface DeletedInGuild extends Deleted {
503
+ /** The id of the server. */
504
+ guildId: Snowflake;
505
+ /** The server the message was in. */
506
+ guild: Guild;
507
+ /** The channel the message was in. */
508
+ channel: GuildTextBasedChannel;
509
+ /** The message as it was, when the bot remembered it. */
510
+ message: GuildMessage | null;
511
+ }
512
+ /** A private message deleted, for a file that receives both kinds. */
513
+ interface DeletedInPrivate extends Deleted {
514
+ /** No server: the message was private. */
515
+ guildId: null;
516
+ /** No server: the message was private. */
517
+ guild: null;
518
+ /** The private conversation, when the bot knows it. */
519
+ channel: DMChannel | null;
520
+ /** The message as it was, when the bot remembered it. */
521
+ message: PrivateMessage | null;
522
+ }
523
+ /** A private message deleted, for a file that only receives those. */
524
+ interface DeletedInDm extends Deleted {
525
+ /** The private conversation, when the bot knows it. */
526
+ channel: DMChannel | null;
527
+ /** The message as it was, when the bot remembered it. */
528
+ message: DmMessage | null;
529
+ }
530
+ type DeletedFor<Where> = Where extends 'guild' ? DeletedInGuild : Where extends 'dm' ? DeletedInDm : DeletedInGuild | DeletedInPrivate;
531
+ /** Where something happened in a server: the server and the channel are there. */
532
+ interface ServerPlace {
533
+ /** The id of the server. */
534
+ guildId: Snowflake;
535
+ /** The server. */
536
+ guild: Guild;
537
+ /** The channel. */
538
+ channel: GuildTextBasedChannel;
539
+ }
540
+ /** Where something happened in private, for a file that receives both kinds. */
541
+ interface PrivatePlace {
542
+ /** No server: it happened in private. */
543
+ guildId: null;
544
+ /** No server: it happened in private. */
545
+ guild: null;
546
+ /** The private conversation, when the bot knows it. */
547
+ channel: DMChannel | null;
548
+ }
549
+ /** Where something happened in private, for a file that only receives that. */
550
+ interface DmPlace {
551
+ /** The private conversation, when the bot knows it. */
552
+ channel: DMChannel | null;
553
+ }
554
+ /** The message of something that happened in a server. */
555
+ interface ServerMessagePart {
556
+ /** The message, when the bot remembers it. */
557
+ message: GuildMessage | null;
558
+ }
559
+ /** The message of something that happened in private, for both kinds. */
560
+ interface PrivateMessagePart {
561
+ /** The message, when the bot remembers it. */
562
+ message: PrivateMessage | null;
563
+ }
564
+ /** The message of something that happened in private, for that only. */
565
+ interface DmMessagePart {
566
+ /** The message, when the bot remembers it. */
567
+ message: DmMessage | null;
568
+ }
569
+ /** The fields an event of servers and private messages narrows. */
570
+ type PlaceKeys = 'guildId' | 'guild' | 'channel' | 'message' | 'member';
571
+ /**
572
+ * What a file receives for an event of servers and private messages,
573
+ * following where it listens: the same fields, plus what each place has.
574
+ */
575
+ type Placed<Where, Common, InServer, InPrivate, InDm> = Where extends 'guild' ? Common & InServer : Where extends 'dm' ? Common & InDm : (Common & InServer) | (Common & InPrivate);
576
+ /** An event about a message, with or without the member who did it. */
577
+ type OnMessage<Name extends EventName, Options, Member> = Placed<WhereOf<Options>, Omit<EventContexts[Name], PlaceKeys>, ServerPlace & ServerMessagePart & Member, PrivatePlace & PrivateMessagePart & ([keyof Member] extends [never] ? object : NoMember), DmPlace & DmMessagePart>;
578
+ /** No member in private: who did it is `user`. */
579
+ interface NoMember {
580
+ /** No member: it happened in private. */
581
+ member: null;
582
+ }
583
+ /** The member who did it, sent with the event. */
584
+ interface SentMember {
585
+ /** Who did it, as a member of the server. */
586
+ member: GuildMember;
587
+ }
588
+ /** The member who did it, when the bot remembers it. */
589
+ interface KnownMember {
590
+ /** Who did it, as a member of the server, when the bot remembers it. */
591
+ member: GuildMember | null;
592
+ }
593
+ /**
594
+ * The events whose handler receives something more precise than
595
+ * `EventContexts`, following where its file listens.
596
+ */
597
+ interface NarrowedContexts<Options> {
598
+ messageCreate: {
599
+ message: MessageFor<Options>;
600
+ };
601
+ messageUpdate: {
602
+ message: MessageFor<Options>;
603
+ };
604
+ messageDelete: DeletedFor<WhereOf<Options>>;
605
+ reactionAdd: OnMessage<'reactionAdd', Options, SentMember>;
606
+ reactionRemove: OnMessage<'reactionRemove', Options, KnownMember>;
607
+ reactionClear: OnMessage<'reactionClear', Options, object>;
608
+ pollVoteAdd: OnMessage<'pollVoteAdd', Options, KnownMember>;
609
+ pollVoteRemove: OnMessage<'pollVoteRemove', Options, KnownMember>;
610
+ typingStart: Placed<WhereOf<Options>, Omit<EventContexts['typingStart'], PlaceKeys>, ServerPlace & SentMember, PrivatePlace & NoMember, DmPlace>;
611
+ }
612
+ /**
613
+ * What your function receives for an event, given the options its file passed
614
+ * to `event()`. `EventContexts` is the widest form: every option on.
615
+ */
616
+ export type ContextOf<Name extends EventName, Options = object> = (Name extends keyof NarrowedContexts<Options> ? NarrowedContexts<Options>[Name] : EventContexts[Name]) & TranslationContext;
617
+ /** The options of an event; nothing for an event without options. */
618
+ export type OptionsOf<Name extends EventName> = Name extends keyof EventOptions ? EventOptions[Name] : {};
619
+ /** One gateway event an event comes from. */
620
+ interface Source<Name extends EventName, E extends GatewayDispatchEventName> {
621
+ on: E;
622
+ /**
623
+ * Reads what the event removes from the cache, before it is removed (the
624
+ * message, member or role "as it was").
625
+ */
626
+ before?: (ctx: Context, data: GatewayDispatchEvents[E]) => unknown;
627
+ /**
628
+ * Gets from Discord what the handlers are promised and the bot does not
629
+ * know yet, before they run. Returns nothing when there is nothing to
630
+ * get, which is nearly always: the event is then delivered at once.
631
+ */
632
+ prepare?: (ctx: Context, data: GatewayDispatchEvents[E]) => Promise<unknown> | undefined;
633
+ /**
634
+ * Builds what the handler receives, once the cache reflects the event.
635
+ * `null` means the event does not happen (a server the bot was already
636
+ * in sending its data is not a server it joined, for example); a list
637
+ * means it happened several times at once (messages deleted together).
638
+ * `prepared` is what `prepare` resolved to.
639
+ */
640
+ build: (ctx: Context, data: GatewayDispatchEvents[E], extra: {
641
+ joined: boolean;
642
+ before: unknown;
643
+ prepared: unknown;
644
+ }) => EventContexts[Name] | readonly EventContexts[Name][] | null;
645
+ }
646
+ export interface EventDefinition<Name extends EventName = EventName> {
647
+ /**
648
+ * The intents that make Discord send this event; from the options of a
649
+ * file when they depend on them, so that nothing is asked to Discord for
650
+ * what no file wants.
651
+ */
652
+ intents: number | ((options: OptionsOf<Name>) => number);
653
+ /**
654
+ * What the bot must remember for this event to give all it can, when it
655
+ * is more than the default: nothing is kept for what no file uses.
656
+ */
657
+ remembers?: Partial<CacheLimits>;
658
+ /**
659
+ * The options a file can pass to `event()`, with the type of each. An
660
+ * event without this has no options.
661
+ */
662
+ options?: {
663
+ [Key in keyof OptionsOf<Name>]-?: 'boolean' | readonly string[];
664
+ };
665
+ /**
666
+ * Whether a file wants this occurrence of the event, given its options.
667
+ * Decided per file: two files of the same folder can differ.
668
+ */
669
+ accepts?: (context: EventContexts[Name], options: OptionsOf<Name>) => boolean;
670
+ /**
671
+ * The server the event happened in, read from what the handler receives:
672
+ * the language `t` speaks. Left out for what happens outside servers.
673
+ */
674
+ guildOf?: (context: EventContexts[Name]) => Guild | null;
675
+ sources: {
676
+ [E in GatewayDispatchEventName]: Source<Name, E>;
677
+ }[GatewayDispatchEventName][];
678
+ }
679
+ /**
680
+ * Discord refused what an event needs before it can be given to its files:
681
+ * the channel it happened in, or the user who did it.
682
+ */
683
+ export declare class MissingForEvent extends Error {
684
+ readonly what: 'channel' | 'user';
685
+ readonly cause: unknown;
686
+ constructor(what: 'channel' | 'user', cause: unknown);
687
+ }
688
+ /**
689
+ * The events, by name. `ready` has no source: it is not a gateway event but
690
+ * the moment the bot has finished connecting.
691
+ */
692
+ export declare const EVENTS: {
693
+ [Name in EventName]: EventDefinition<Name>;
694
+ };
695
+ export declare const EVENT_NAMES: EventName[];
696
+ export declare function isEventName(name: unknown): name is EventName;
697
+ export {};