@erinjs/core 1.0.0 → 1.2.4

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 (394) hide show
  1. package/{core/LICENSE → LICENSE} +203 -203
  2. package/README.md +46 -0
  3. package/dist/index.d.mts +2084 -0
  4. package/dist/index.d.ts +2084 -0
  5. package/dist/index.js +3867 -0
  6. package/dist/index.mjs +3809 -0
  7. package/package.json +50 -15
  8. package/core/.changeset/README.md +0 -8
  9. package/core/.changeset/community-bootstrap-release.md +0 -17
  10. package/core/.changeset/config.json +0 -11
  11. package/core/.changeset/no-changelog.js +0 -16
  12. package/core/.changeset/pre.json +0 -17
  13. package/core/.editorconfig +0 -13
  14. package/core/.gitattributes +0 -2
  15. package/core/.github/CODE_OF_CONDUCT.md +0 -23
  16. package/core/.github/FUNDING.yml +0 -7
  17. package/core/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
  18. package/core/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
  19. package/core/.github/PULL_REQUEST_TEMPLATE.md +0 -16
  20. package/core/.github/dependabot.yml +0 -16
  21. package/core/.github/workflows/autoapp.yml +0 -16
  22. package/core/.github/workflows/ci.yml +0 -187
  23. package/core/.github/workflows/codeql.yml +0 -30
  24. package/core/.github/workflows/deploy-docs.yml +0 -54
  25. package/core/.github/workflows/publish.yml +0 -43
  26. package/core/.lintstagedrc.json +0 -4
  27. package/core/.nvmrc +0 -1
  28. package/core/.prettierignore +0 -8
  29. package/core/.prettierrc +0 -11
  30. package/core/CONTRIBUTING.md +0 -70
  31. package/core/README.md +0 -61
  32. package/core/SECURITY.md +0 -21
  33. package/core/apps/docs/index.html +0 -28
  34. package/core/apps/docs/middleware.ts +0 -21
  35. package/core/apps/docs/package.json +0 -33
  36. package/core/apps/docs/public/@flux.png +0 -0
  37. package/core/apps/docs/public/docs/latest/guides.json +0 -1420
  38. package/core/apps/docs/public/docs/latest/main.json +0 -14981
  39. package/core/apps/docs/public/docs/latest/rag-index.json +0 -1
  40. package/core/apps/docs/public/docs/v1.0.5/guides.json +0 -226
  41. package/core/apps/docs/public/docs/v1.0.5/main.json +0 -7920
  42. package/core/apps/docs/public/docs/v1.0.6/guides.json +0 -226
  43. package/core/apps/docs/public/docs/v1.0.6/main.json +0 -7920
  44. package/core/apps/docs/public/docs/v1.0.7/guides.json +0 -259
  45. package/core/apps/docs/public/docs/v1.0.7/main.json +0 -8652
  46. package/core/apps/docs/public/docs/v1.0.8/guides.json +0 -313
  47. package/core/apps/docs/public/docs/v1.0.8/main.json +0 -9618
  48. package/core/apps/docs/public/docs/v1.0.9/guides.json +0 -319
  49. package/core/apps/docs/public/docs/v1.0.9/main.json +0 -10694
  50. package/core/apps/docs/public/docs/v1.1.0/guides.json +0 -589
  51. package/core/apps/docs/public/docs/v1.1.0/main.json +0 -12576
  52. package/core/apps/docs/public/docs/v1.1.2/guides.json +0 -650
  53. package/core/apps/docs/public/docs/v1.1.2/main.json +0 -13239
  54. package/core/apps/docs/public/docs/v1.1.3/guides.json +0 -650
  55. package/core/apps/docs/public/docs/v1.1.3/main.json +0 -13239
  56. package/core/apps/docs/public/docs/v1.1.4/guides.json +0 -708
  57. package/core/apps/docs/public/docs/v1.1.4/main.json +0 -13231
  58. package/core/apps/docs/public/docs/v1.1.5/guides.json +0 -1035
  59. package/core/apps/docs/public/docs/v1.1.5/main.json +0 -13838
  60. package/core/apps/docs/public/docs/v1.1.6/guides.json +0 -1041
  61. package/core/apps/docs/public/docs/v1.1.6/main.json +0 -14313
  62. package/core/apps/docs/public/docs/v1.1.8/guides.json +0 -1047
  63. package/core/apps/docs/public/docs/v1.1.8/main.json +0 -14421
  64. package/core/apps/docs/public/docs/v1.1.9/guides.json +0 -1047
  65. package/core/apps/docs/public/docs/v1.1.9/main.json +0 -14421
  66. package/core/apps/docs/public/docs/v1.2.0/guides.json +0 -1212
  67. package/core/apps/docs/public/docs/v1.2.0/main.json +0 -14663
  68. package/core/apps/docs/public/docs/v1.2.1/guides.json +0 -1293
  69. package/core/apps/docs/public/docs/v1.2.1/main.json +0 -14828
  70. package/core/apps/docs/public/docs/v1.2.2/guides.json +0 -1293
  71. package/core/apps/docs/public/docs/v1.2.2/main.json +0 -15025
  72. package/core/apps/docs/public/docs/v1.2.3/guides.json +0 -1420
  73. package/core/apps/docs/public/docs/v1.2.3/main.json +0 -14954
  74. package/core/apps/docs/public/docs/v1.2.4/guides.json +0 -1420
  75. package/core/apps/docs/public/docs/v1.2.4/main.json +0 -14981
  76. package/core/apps/docs/public/docs/versions.json +0 -24
  77. package/core/apps/docs/public/flux.png +0 -0
  78. package/core/apps/docs/public/locales/en.json +0 -50
  79. package/core/apps/docs/public/locales/guides-en.json +0 -512
  80. package/core/apps/docs/public/robots.txt +0 -4
  81. package/core/apps/docs/public/sitemap.xml +0 -33
  82. package/core/apps/docs/src/App.vue +0 -538
  83. package/core/apps/docs/src/components/ApiCategorySection.vue +0 -42
  84. package/core/apps/docs/src/components/ApiDiscordCompat.vue +0 -65
  85. package/core/apps/docs/src/components/ApiEndpointCard.vue +0 -313
  86. package/core/apps/docs/src/components/ApiSchemaBlock.vue +0 -131
  87. package/core/apps/docs/src/components/CodeBlock.vue +0 -177
  88. package/core/apps/docs/src/components/CommunityCallout.vue +0 -90
  89. package/core/apps/docs/src/components/ConstructorSection.vue +0 -82
  90. package/core/apps/docs/src/components/DocDescription.vue +0 -40
  91. package/core/apps/docs/src/components/FluxerLogo.vue +0 -3
  92. package/core/apps/docs/src/components/Footer.vue +0 -106
  93. package/core/apps/docs/src/components/GuideCodeBlock.vue +0 -102
  94. package/core/apps/docs/src/components/GuideDiscordCompat.vue +0 -77
  95. package/core/apps/docs/src/components/GuideDiscordCompatCallout.vue +0 -83
  96. package/core/apps/docs/src/components/GuideTable.vue +0 -77
  97. package/core/apps/docs/src/components/GuideTip.vue +0 -38
  98. package/core/apps/docs/src/components/MethodsSection.vue +0 -195
  99. package/core/apps/docs/src/components/ParamsTable.vue +0 -70
  100. package/core/apps/docs/src/components/PropertiesSection.vue +0 -143
  101. package/core/apps/docs/src/components/SearchBar.vue +0 -76
  102. package/core/apps/docs/src/components/SearchModal.vue +0 -361
  103. package/core/apps/docs/src/components/SidebarNav.vue +0 -225
  104. package/core/apps/docs/src/components/SponsorBanner.vue +0 -153
  105. package/core/apps/docs/src/components/TypeSignature.vue +0 -187
  106. package/core/apps/docs/src/components/VersionPicker.vue +0 -191
  107. package/core/apps/docs/src/composables/useSearchIndex.ts +0 -144
  108. package/core/apps/docs/src/composables/useVersionedPath.ts +0 -20
  109. package/core/apps/docs/src/data/apiEndpoints.ts +0 -1073
  110. package/core/apps/docs/src/data/changelog.ts +0 -717
  111. package/core/apps/docs/src/data/guides.ts +0 -2362
  112. package/core/apps/docs/src/env.d.ts +0 -7
  113. package/core/apps/docs/src/locales/guides-en.json +0 -512
  114. package/core/apps/docs/src/main.ts +0 -27
  115. package/core/apps/docs/src/pages/ApiReferenceLayout.vue +0 -175
  116. package/core/apps/docs/src/pages/ApiReferencePage.vue +0 -128
  117. package/core/apps/docs/src/pages/Changelog.vue +0 -288
  118. package/core/apps/docs/src/pages/ClassPage.vue +0 -319
  119. package/core/apps/docs/src/pages/ClassesList.vue +0 -100
  120. package/core/apps/docs/src/pages/DocsLayout.vue +0 -127
  121. package/core/apps/docs/src/pages/GuidePage.vue +0 -279
  122. package/core/apps/docs/src/pages/GuidesIndex.vue +0 -166
  123. package/core/apps/docs/src/pages/GuidesLayout.vue +0 -245
  124. package/core/apps/docs/src/pages/Home.vue +0 -125
  125. package/core/apps/docs/src/pages/NotFound.vue +0 -57
  126. package/core/apps/docs/src/pages/TypedefPage.vue +0 -230
  127. package/core/apps/docs/src/pages/TypedefsList.vue +0 -168
  128. package/core/apps/docs/src/pages/VersionLayout.vue +0 -15
  129. package/core/apps/docs/src/router.ts +0 -73
  130. package/core/apps/docs/src/stores/docs.ts +0 -54
  131. package/core/apps/docs/src/stores/guides.ts +0 -53
  132. package/core/apps/docs/src/stores/version.ts +0 -67
  133. package/core/apps/docs/src/styles/main.css +0 -278
  134. package/core/apps/docs/src/styles/prism.css +0 -95
  135. package/core/apps/docs/src/types/doc-schema.ts +0 -112
  136. package/core/apps/docs/tsconfig.json +0 -17
  137. package/core/apps/docs/tsconfig.node.json +0 -10
  138. package/core/apps/docs/vite.config.d.ts +0 -2
  139. package/core/apps/docs/vite.config.js +0 -26
  140. package/core/apps/docs/vite.config.ts +0 -28
  141. package/core/apps/docs-vitepress/.vitepress/config.ts +0 -141
  142. package/core/apps/docs-vitepress/api-data/latest/main.json +0 -15035
  143. package/core/apps/docs-vitepress/api-data/v1.2.4/main.json +0 -15035
  144. package/core/apps/docs-vitepress/api-data/versions.json +0 -6
  145. package/core/apps/docs-vitepress/index.md +0 -15
  146. package/core/apps/docs-vitepress/package-lock.json +0 -2924
  147. package/core/apps/docs-vitepress/package.json +0 -20
  148. package/core/apps/docs-vitepress/public/CNAME +0 -1
  149. package/core/apps/docs-vitepress/scripts/generate-api.ts +0 -243
  150. package/core/apps/docs-vitepress/scripts/migrate-guides.ts +0 -129
  151. package/core/apps/docs-vitepress/tsconfig.json +0 -11
  152. package/core/apps/docs-vitepress/v/latest/guides/attachments-by-url.md +0 -57
  153. package/core/apps/docs-vitepress/v/latest/guides/attachments.md +0 -62
  154. package/core/apps/docs-vitepress/v/latest/guides/basic-bot.md +0 -49
  155. package/core/apps/docs-vitepress/v/latest/guides/channels.md +0 -180
  156. package/core/apps/docs-vitepress/v/latest/guides/deprecated-apis.md +0 -58
  157. package/core/apps/docs-vitepress/v/latest/guides/discord-js-compatibility.md +0 -42
  158. package/core/apps/docs-vitepress/v/latest/guides/editing-embeds.md +0 -65
  159. package/core/apps/docs-vitepress/v/latest/guides/embed-media.md +0 -87
  160. package/core/apps/docs-vitepress/v/latest/guides/embeds.md +0 -166
  161. package/core/apps/docs-vitepress/v/latest/guides/emojis.md +0 -77
  162. package/core/apps/docs-vitepress/v/latest/guides/events.md +0 -202
  163. package/core/apps/docs-vitepress/v/latest/guides/gifs.md +0 -47
  164. package/core/apps/docs-vitepress/v/latest/guides/installation.md +0 -10
  165. package/core/apps/docs-vitepress/v/latest/guides/moderation.md +0 -89
  166. package/core/apps/docs-vitepress/v/latest/guides/permissions.md +0 -130
  167. package/core/apps/docs-vitepress/v/latest/guides/prefix-commands.md +0 -41
  168. package/core/apps/docs-vitepress/v/latest/guides/profile-urls.md +0 -58
  169. package/core/apps/docs-vitepress/v/latest/guides/reactions.md +0 -69
  170. package/core/apps/docs-vitepress/v/latest/guides/roles.md +0 -130
  171. package/core/apps/docs-vitepress/v/latest/guides/sending-without-reply.md +0 -172
  172. package/core/apps/docs-vitepress/v/latest/guides/voice.md +0 -109
  173. package/core/apps/docs-vitepress/v/latest/guides/wait-for-guilds.md +0 -37
  174. package/core/apps/docs-vitepress/v/latest/guides/webhook-attachments-embeds.md +0 -73
  175. package/core/apps/docs-vitepress/v/latest/guides/webhooks.md +0 -131
  176. package/core/eslint.config.js +0 -80
  177. package/core/examples/.env.example +0 -22
  178. package/core/examples/README.md +0 -68
  179. package/core/examples/first-steps-bot.js +0 -118
  180. package/core/examples/minimal-bot.js +0 -17
  181. package/core/examples/moderation-bot.js +0 -209
  182. package/core/examples/package.json +0 -14
  183. package/core/examples/ping-bot.js +0 -1146
  184. package/core/examples/reaction-bot.js +0 -70
  185. package/core/examples/reaction-roles-bot.js +0 -140
  186. package/core/examples/webhook-bot.js +0 -239
  187. package/core/flux.png +0 -0
  188. package/core/package.json +0 -78
  189. package/core/packages/builders/package.json +0 -51
  190. package/core/packages/builders/src/index.ts +0 -13
  191. package/core/packages/builders/src/messages/AttachmentBuilder.test.ts +0 -79
  192. package/core/packages/builders/src/messages/AttachmentBuilder.ts +0 -69
  193. package/core/packages/builders/src/messages/EmbedBuilder.test.ts +0 -266
  194. package/core/packages/builders/src/messages/EmbedBuilder.ts +0 -239
  195. package/core/packages/builders/src/messages/MessagePayload.test.ts +0 -118
  196. package/core/packages/builders/src/messages/MessagePayload.ts +0 -122
  197. package/core/packages/builders/tsconfig.json +0 -9
  198. package/core/packages/builders/tsup.config.ts +0 -9
  199. package/core/packages/builders/vitest.config.ts +0 -9
  200. package/core/packages/collection/package.json +0 -47
  201. package/core/packages/collection/src/Collection.test.ts +0 -232
  202. package/core/packages/collection/src/Collection.ts +0 -196
  203. package/core/packages/collection/src/index.ts +0 -1
  204. package/core/packages/collection/tsconfig.json +0 -9
  205. package/core/packages/collection/tsup.config.ts +0 -9
  206. package/core/packages/collection/vitest.config.ts +0 -9
  207. package/core/packages/docgen/package.json +0 -26
  208. package/core/packages/docgen/src/extract.ts +0 -262
  209. package/core/packages/docgen/src/formatType.ts +0 -24
  210. package/core/packages/docgen/src/index.ts +0 -103
  211. package/core/packages/docgen/src/schema.ts +0 -100
  212. package/core/packages/docgen/src/visitor.ts +0 -147
  213. package/core/packages/docgen/tsconfig.json +0 -9
  214. package/core/packages/docgen/tsup.config.ts +0 -9
  215. package/core/packages/fluxer-core/README.md +0 -26
  216. package/core/packages/fluxer-core/package.json +0 -60
  217. package/core/packages/fluxer-core/src/client/ChannelManager.ts +0 -143
  218. package/core/packages/fluxer-core/src/client/Client.gateway.test.ts +0 -84
  219. package/core/packages/fluxer-core/src/client/Client.resolveEmoji.test.ts +0 -45
  220. package/core/packages/fluxer-core/src/client/Client.ts +0 -558
  221. package/core/packages/fluxer-core/src/client/ClientUser.ts +0 -40
  222. package/core/packages/fluxer-core/src/client/EventHandlerRegistry.ts +0 -469
  223. package/core/packages/fluxer-core/src/client/GuildManager.ts +0 -79
  224. package/core/packages/fluxer-core/src/client/GuildMemberManager.ts +0 -91
  225. package/core/packages/fluxer-core/src/client/MessageManager.ts +0 -58
  226. package/core/packages/fluxer-core/src/client/UsersManager.ts +0 -122
  227. package/core/packages/fluxer-core/src/errors/ErrorCodes.test.ts +0 -19
  228. package/core/packages/fluxer-core/src/errors/ErrorCodes.ts +0 -12
  229. package/core/packages/fluxer-core/src/errors/FluxerError.test.ts +0 -32
  230. package/core/packages/fluxer-core/src/errors/FluxerError.ts +0 -15
  231. package/core/packages/fluxer-core/src/index.ts +0 -85
  232. package/core/packages/fluxer-core/src/structures/Base.ts +0 -7
  233. package/core/packages/fluxer-core/src/structures/Channel.ts +0 -508
  234. package/core/packages/fluxer-core/src/structures/Guild.test.ts +0 -189
  235. package/core/packages/fluxer-core/src/structures/Guild.ts +0 -734
  236. package/core/packages/fluxer-core/src/structures/GuildBan.ts +0 -35
  237. package/core/packages/fluxer-core/src/structures/GuildEmoji.ts +0 -57
  238. package/core/packages/fluxer-core/src/structures/GuildMember.test.ts +0 -203
  239. package/core/packages/fluxer-core/src/structures/GuildMember.ts +0 -213
  240. package/core/packages/fluxer-core/src/structures/GuildMemberRoleManager.ts +0 -121
  241. package/core/packages/fluxer-core/src/structures/GuildSticker.ts +0 -56
  242. package/core/packages/fluxer-core/src/structures/Invite.test.ts +0 -103
  243. package/core/packages/fluxer-core/src/structures/Invite.ts +0 -121
  244. package/core/packages/fluxer-core/src/structures/Message.test.ts +0 -109
  245. package/core/packages/fluxer-core/src/structures/Message.ts +0 -397
  246. package/core/packages/fluxer-core/src/structures/MessageReaction.ts +0 -72
  247. package/core/packages/fluxer-core/src/structures/PartialMessage.ts +0 -12
  248. package/core/packages/fluxer-core/src/structures/Role.test.ts +0 -77
  249. package/core/packages/fluxer-core/src/structures/Role.ts +0 -112
  250. package/core/packages/fluxer-core/src/structures/User.test.ts +0 -110
  251. package/core/packages/fluxer-core/src/structures/User.ts +0 -109
  252. package/core/packages/fluxer-core/src/structures/Webhook.test.ts +0 -109
  253. package/core/packages/fluxer-core/src/structures/Webhook.ts +0 -258
  254. package/core/packages/fluxer-core/src/util/Constants.test.ts +0 -16
  255. package/core/packages/fluxer-core/src/util/Constants.ts +0 -7
  256. package/core/packages/fluxer-core/src/util/Events.ts +0 -46
  257. package/core/packages/fluxer-core/src/util/MessageCollector.ts +0 -87
  258. package/core/packages/fluxer-core/src/util/Options.ts +0 -33
  259. package/core/packages/fluxer-core/src/util/ReactionCollector.ts +0 -116
  260. package/core/packages/fluxer-core/src/util/cdn.test.ts +0 -108
  261. package/core/packages/fluxer-core/src/util/cdn.ts +0 -130
  262. package/core/packages/fluxer-core/src/util/guildUtils.ts +0 -33
  263. package/core/packages/fluxer-core/src/util/messageUtils.test.ts +0 -74
  264. package/core/packages/fluxer-core/src/util/messageUtils.ts +0 -119
  265. package/core/packages/fluxer-core/src/util/permissions.test.ts +0 -95
  266. package/core/packages/fluxer-core/src/util/permissions.ts +0 -43
  267. package/core/packages/fluxer-core/tsconfig.json +0 -9
  268. package/core/packages/fluxer-core/tsup.config.ts +0 -9
  269. package/core/packages/fluxer-core/vitest.config.ts +0 -9
  270. package/core/packages/rest/package.json +0 -52
  271. package/core/packages/rest/src/REST.test.ts +0 -64
  272. package/core/packages/rest/src/REST.ts +0 -90
  273. package/core/packages/rest/src/RateLimitManager.test.ts +0 -71
  274. package/core/packages/rest/src/RateLimitManager.ts +0 -60
  275. package/core/packages/rest/src/RequestManager.test.ts +0 -87
  276. package/core/packages/rest/src/RequestManager.ts +0 -172
  277. package/core/packages/rest/src/errors/FluxerAPIError.test.ts +0 -57
  278. package/core/packages/rest/src/errors/FluxerAPIError.ts +0 -21
  279. package/core/packages/rest/src/errors/HTTPError.test.ts +0 -55
  280. package/core/packages/rest/src/errors/HTTPError.ts +0 -25
  281. package/core/packages/rest/src/errors/RateLimitError.test.ts +0 -41
  282. package/core/packages/rest/src/errors/RateLimitError.ts +0 -15
  283. package/core/packages/rest/src/errors/index.ts +0 -3
  284. package/core/packages/rest/src/index.ts +0 -6
  285. package/core/packages/rest/src/utils/constants.test.ts +0 -31
  286. package/core/packages/rest/src/utils/constants.ts +0 -5
  287. package/core/packages/rest/src/utils/files.test.ts +0 -37
  288. package/core/packages/rest/src/utils/files.ts +0 -75
  289. package/core/packages/rest/tsconfig.json +0 -9
  290. package/core/packages/rest/tsup.config.ts +0 -9
  291. package/core/packages/rest/vitest.config.ts +0 -9
  292. package/core/packages/types/package.json +0 -46
  293. package/core/packages/types/src/api/ban.ts +0 -8
  294. package/core/packages/types/src/api/channel.ts +0 -65
  295. package/core/packages/types/src/api/embed.ts +0 -82
  296. package/core/packages/types/src/api/emoji.ts +0 -12
  297. package/core/packages/types/src/api/errors.ts +0 -68
  298. package/core/packages/types/src/api/gateway.ts +0 -14
  299. package/core/packages/types/src/api/guild.ts +0 -123
  300. package/core/packages/types/src/api/index.ts +0 -15
  301. package/core/packages/types/src/api/instance.ts +0 -32
  302. package/core/packages/types/src/api/interaction.ts +0 -26
  303. package/core/packages/types/src/api/invite.ts +0 -28
  304. package/core/packages/types/src/api/message.ts +0 -140
  305. package/core/packages/types/src/api/role.ts +0 -41
  306. package/core/packages/types/src/api/sticker.ts +0 -14
  307. package/core/packages/types/src/api/user.ts +0 -79
  308. package/core/packages/types/src/api/webhook.ts +0 -41
  309. package/core/packages/types/src/common/index.ts +0 -1
  310. package/core/packages/types/src/common/snowflake.test.ts +0 -9
  311. package/core/packages/types/src/common/snowflake.ts +0 -8
  312. package/core/packages/types/src/gateway/events.ts +0 -189
  313. package/core/packages/types/src/gateway/index.ts +0 -3
  314. package/core/packages/types/src/gateway/opcodes.ts +0 -17
  315. package/core/packages/types/src/gateway/payloads.ts +0 -481
  316. package/core/packages/types/src/index.ts +0 -4
  317. package/core/packages/types/src/rest/index.ts +0 -1
  318. package/core/packages/types/src/rest/routes.test.ts +0 -169
  319. package/core/packages/types/src/rest/routes.ts +0 -109
  320. package/core/packages/types/tsconfig.json +0 -9
  321. package/core/packages/types/tsup.config.ts +0 -9
  322. package/core/packages/types/vitest.config.ts +0 -9
  323. package/core/packages/util/package.json +0 -51
  324. package/core/packages/util/src/BitField.test.ts +0 -96
  325. package/core/packages/util/src/BitField.ts +0 -105
  326. package/core/packages/util/src/MessageFlagsBitField.test.ts +0 -42
  327. package/core/packages/util/src/MessageFlagsBitField.ts +0 -20
  328. package/core/packages/util/src/PermissionsBitField.test.ts +0 -79
  329. package/core/packages/util/src/PermissionsBitField.ts +0 -97
  330. package/core/packages/util/src/SnowflakeUtil.test.ts +0 -69
  331. package/core/packages/util/src/SnowflakeUtil.ts +0 -65
  332. package/core/packages/util/src/UserFlagsBitField.test.ts +0 -39
  333. package/core/packages/util/src/UserFlagsBitField.ts +0 -48
  334. package/core/packages/util/src/deprecation.test.ts +0 -44
  335. package/core/packages/util/src/deprecation.ts +0 -28
  336. package/core/packages/util/src/emojiShortcodes.generated.ts +0 -5
  337. package/core/packages/util/src/emojiShortcodes.test.ts +0 -41
  338. package/core/packages/util/src/emojiShortcodes.ts +0 -22
  339. package/core/packages/util/src/formatters.test.ts +0 -65
  340. package/core/packages/util/src/formatters.ts +0 -35
  341. package/core/packages/util/src/index.ts +0 -34
  342. package/core/packages/util/src/resolvers.test.ts +0 -198
  343. package/core/packages/util/src/resolvers.ts +0 -127
  344. package/core/packages/util/src/tenorUtils.test.ts +0 -75
  345. package/core/packages/util/src/tenorUtils.ts +0 -86
  346. package/core/packages/util/tsconfig.json +0 -9
  347. package/core/packages/util/tsup.config.ts +0 -9
  348. package/core/packages/util/vitest.config.ts +0 -9
  349. package/core/packages/voice/README.md +0 -42
  350. package/core/packages/voice/package.json +0 -67
  351. package/core/packages/voice/src/LiveKitRtcConnection.receive.test.ts +0 -24
  352. package/core/packages/voice/src/LiveKitRtcConnection.ts +0 -1767
  353. package/core/packages/voice/src/VoiceConnection.ts +0 -413
  354. package/core/packages/voice/src/VoiceManager.receive.test.ts +0 -61
  355. package/core/packages/voice/src/VoiceManager.test.ts +0 -44
  356. package/core/packages/voice/src/VoiceManager.ts +0 -503
  357. package/core/packages/voice/src/exports.test.ts +0 -38
  358. package/core/packages/voice/src/index.ts +0 -51
  359. package/core/packages/voice/src/livekit.test.ts +0 -48
  360. package/core/packages/voice/src/livekit.ts +0 -33
  361. package/core/packages/voice/src/mp4box.d.ts +0 -32
  362. package/core/packages/voice/src/opusUtils.test.ts +0 -29
  363. package/core/packages/voice/src/opusUtils.ts +0 -86
  364. package/core/packages/voice/src/streamPreviewPlaceholder.test.ts +0 -16
  365. package/core/packages/voice/src/streamPreviewPlaceholder.ts +0 -8
  366. package/core/packages/voice/src/ws.d.ts +0 -1
  367. package/core/packages/voice/tsconfig.json +0 -5
  368. package/core/packages/voice/tsup.config.ts +0 -10
  369. package/core/packages/voice/vitest.config.ts +0 -9
  370. package/core/packages/ws/package.json +0 -52
  371. package/core/packages/ws/src/WebSocketManager.ts +0 -130
  372. package/core/packages/ws/src/WebSocketShard.ts +0 -296
  373. package/core/packages/ws/src/index.ts +0 -12
  374. package/core/packages/ws/src/utils/constants.test.ts +0 -46
  375. package/core/packages/ws/src/utils/constants.ts +0 -22
  376. package/core/packages/ws/src/utils/getWebSocket.ts +0 -55
  377. package/core/packages/ws/src/ws.d.ts +0 -10
  378. package/core/packages/ws/tsconfig.json +0 -9
  379. package/core/packages/ws/tsup.config.ts +0 -9
  380. package/core/pnpm-lock.yaml +0 -7033
  381. package/core/pnpm-workspace.yaml +0 -4
  382. package/core/scripts/generate-ai-rag.ts +0 -240
  383. package/core/scripts/generate-docs.ts +0 -143
  384. package/core/scripts/generate-emoji-shortcodes.ts +0 -58
  385. package/core/scripts/generate-types.ts +0 -6
  386. package/core/scripts/publish-ordered.js +0 -63
  387. package/core/scripts/test-cjs-require.mjs +0 -43
  388. package/core/scripts/test-esm-imports.mjs +0 -42
  389. package/core/scripts/test-package-exports.mjs +0 -98
  390. package/core/scripts/test-smoke.mjs +0 -103
  391. package/core/tsconfig.json +0 -18
  392. package/core/turbo.json +0 -30
  393. package/core/vitest.config.ts +0 -17
  394. package/core/wrangler.jsonc +0 -9
@@ -0,0 +1,2084 @@
1
+ import { EventEmitter } from 'events';
2
+ import { REST } from '@erinjs/rest';
3
+ import { WebSocketManager } from '@erinjs/ws';
4
+ import { APIEmbed, APIUserPartial, APIRole, RESTUpdateRoleBody, APIGuildMember, APIWebhook, APIWebhookUpdateRequest, APIWebhookTokenUpdateRequest, APIWebhookEditMessageRequest, APIBan, APIEmoji, APISticker, APIGuildPartial, APIChannelPartial, APIInvite, GuildFeature, GuildVerificationLevel, DefaultMessageNotifications, GuildExplicitContentFilter, GuildMFALevel, APIGuild, RESTCreateRoleBody, APIGuildAuditLog, APIVanityURL, GatewayReactionEmoji, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, APIMessageAttachment, MessageType, APIMessageSticker, APIMessageReaction, APIMessageReference, APIMessageSnapshot, APIMessageCall, APIMessage, APIChannelOverwrite, APIChannel, ChannelType, GatewayPresenceUpdateData, APIProfileResponse, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, APIApplicationCommandInteraction, GatewayGuildMembersChunkDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayMessageDeleteBulkDispatchData, GatewayGuildEmojisUpdateDispatchData, GatewayGuildStickersUpdateDispatchData, GatewayGuildIntegrationsUpdateDispatchData, GatewayGuildRoleCreateDispatchData, GatewayGuildRoleUpdateDispatchData, GatewayGuildRoleDeleteDispatchData, GatewayGuildScheduledEventCreateDispatchData, GatewayGuildScheduledEventUpdateDispatchData, GatewayGuildScheduledEventDeleteDispatchData, GatewayChannelPinsUpdateDispatchData, GatewayInviteDeleteDispatchData, GatewayTypingStartDispatchData, GatewayUserUpdateDispatchData, GatewayPresenceUpdateDispatchData, GatewayWebhooksUpdateDispatchData, APIInstance, APIGatewayBotResponse, GatewaySendPayload, Routes } from '@erinjs/types';
5
+ export { GatewayOpcodes, MessageAttachmentFlags, Routes } from '@erinjs/types';
6
+ import { Collection } from '@erinjs/collection';
7
+ import { EmbedBuilder } from '@erinjs/builders';
8
+ export { AttachmentBuilder, EmbedBuilder, MessagePayload } from '@erinjs/builders';
9
+ import { PermissionsBitField, PermissionResolvable, BitField } from '@erinjs/util';
10
+ export { PermissionFlags, PermissionResolvable, PermissionString, PermissionsBitField, UserFlagsBitField, UserFlagsBits, UserFlagsResolvable, UserFlagsString, parsePrefixCommand, parseUserMention, resolvePermissionsToBitfield, resolveTenorToImageUrl } from '@erinjs/util';
11
+
12
+ /** Resolved file data (after URL fetch). Used internally by REST layer. */
13
+ interface ResolvedMessageFile {
14
+ name: string;
15
+ data: Blob | ArrayBuffer | Uint8Array | Buffer;
16
+ filename?: string;
17
+ }
18
+ /** File data for message attachment uploads. Use `data` for buffers or `url` to fetch from a URL. */
19
+ type MessageFileData = {
20
+ name: string;
21
+ data: Blob | ArrayBuffer | Uint8Array | Buffer;
22
+ filename?: string;
23
+ } | {
24
+ name: string;
25
+ url: string;
26
+ filename?: string;
27
+ };
28
+ /** Attachment metadata for file uploads (id matches FormData index). */
29
+ interface MessageAttachmentMeta {
30
+ id: number;
31
+ filename: string;
32
+ title?: string | null;
33
+ description?: string | null;
34
+ /** MessageAttachmentFlags: IS_SPOILER (8), CONTAINS_EXPLICIT_MEDIA (16), IS_ANIMATED (32) */
35
+ flags?: number;
36
+ }
37
+ /** Options for sending a message (content, embeds, files). Used by Message.send, Channel.send, ChannelManager.send.
38
+ * EmbedBuilder instances are auto-converted to API format—no need to call .toJSON().
39
+ */
40
+ type MessageSendOptions = {
41
+ content?: string;
42
+ /** EmbedBuilder instances are auto-converted; raw APIEmbed also supported. */
43
+ embeds?: (APIEmbed | EmbedBuilder)[];
44
+ /** File attachments. When present, request uses multipart/form-data. */
45
+ files?: MessageFileData[];
46
+ /** Attachment metadata for files (id = index). Use when files are provided. */
47
+ attachments?: MessageAttachmentMeta[];
48
+ /** Message flags (e.g. MessageFlags.SuppressNotifications for reply without ping). */
49
+ flags?: number;
50
+ };
51
+ /** API-ready body from MessageSendOptions or text content (serializes EmbedBuilder, includes attachments when files present). */
52
+ interface SendBodyResult {
53
+ content?: string;
54
+ embeds?: APIEmbed[];
55
+ attachments?: Array<{
56
+ id: number;
57
+ filename: string;
58
+ title?: string | null;
59
+ description?: string | null;
60
+ flags?: number;
61
+ }>;
62
+ /** Message flags (e.g. SuppressNotifications for reply without ping). */
63
+ flags?: number;
64
+ }
65
+
66
+ /** Base class for all Fluxer structures. Provides the client reference. */
67
+ declare abstract class Base {
68
+ /** The client instance this structure belongs to. */
69
+ abstract readonly client: Client;
70
+ }
71
+
72
+ /** Represents a user (or bot) on Fluxer. */
73
+ declare class User extends Base {
74
+ readonly client: Client;
75
+ readonly id: string;
76
+ username: string;
77
+ discriminator: string;
78
+ globalName: string | null;
79
+ avatar: string | null;
80
+ readonly bot: boolean;
81
+ /** RGB avatar color (e.g. 7577782). Null if not set. */
82
+ avatarColor: number | null;
83
+ /** Public flags bitfield. Null if not set. */
84
+ flags: number | null;
85
+ /** Whether this is an official system user. */
86
+ readonly system: boolean;
87
+ /** Banner hash (from profile, member, or invite context). Null when not available. */
88
+ banner: string | null;
89
+ /** @param data - API user from message author, GET /users/{id}, or GET /users/@me */
90
+ constructor(client: Client, data: APIUserPartial);
91
+ /** Update mutable fields from fresh API data. Used by getOrCreateUser cache. */
92
+ _patch(data: APIUserPartial): void;
93
+ /**
94
+ * Get the URL for this user's avatar.
95
+ * Auto-detects animated avatars (hash starting with `a_`) and uses gif extension.
96
+ * @param options - Optional `size` and `extension` (default: png, or gif for animated)
97
+ */
98
+ avatarURL(options?: {
99
+ size?: number;
100
+ extension?: string;
101
+ }): string | null;
102
+ /** Get the avatar URL, or the default avatar if none set (Fluxer: fluxerstatic.com). */
103
+ displayAvatarURL(options?: {
104
+ size?: number;
105
+ extension?: string;
106
+ }): string;
107
+ /**
108
+ * Get the URL for this user's banner.
109
+ * Returns null if the user has no banner (only available when fetched from profile/member context).
110
+ */
111
+ bannerURL(options?: {
112
+ size?: number;
113
+ extension?: string;
114
+ }): string | null;
115
+ /** Returns a mention string (e.g. `<@123456>`). */
116
+ toString(): string;
117
+ /**
118
+ * Create or get a DM channel with this user.
119
+ * Returns the DM channel; use {@link DMChannel.send} to send messages.
120
+ */
121
+ createDM(): Promise<DMChannel>;
122
+ /**
123
+ * Send a DM to this user.
124
+ * Convenience method that creates the DM channel and sends the message.
125
+ */
126
+ send(options: MessageSendOptions): Promise<Message>;
127
+ }
128
+
129
+ /** Represents a role in a guild. */
130
+ declare class Role extends Base {
131
+ readonly client: Client;
132
+ readonly id: string;
133
+ readonly guildId: string;
134
+ name: string;
135
+ color: number;
136
+ position: number;
137
+ _permissions: string;
138
+ hoist: boolean;
139
+ mentionable: boolean;
140
+ unicodeEmoji: string | null;
141
+ /** Separately sorted position for hoisted roles. Null if not set. */
142
+ hoistPosition: number | null;
143
+ /** @param client - The client instance */
144
+ /** @param data - API role from GET /guilds/{id}/roles or gateway role events */
145
+ /** @param guildId - The guild this role belongs to */
146
+ constructor(client: Client, data: APIRole, guildId: string);
147
+ get permissions(): PermissionsBitField;
148
+ /** Update mutable fields from fresh API data. Used by edit and gateway events. */
149
+ _patch(data: Partial<APIRole>): void;
150
+ /** Returns a mention string (e.g. `<@&123456>`). */
151
+ toString(): string;
152
+ /**
153
+ * Edit this role.
154
+ * Requires Manage Roles permission.
155
+ * @param options - Role updates (permissions accepts PermissionResolvable for convenience)
156
+ * @returns This role (updated in place)
157
+ * @example
158
+ * await role.edit({ name: 'Moderator', permissions: ['BanMembers', 'KickMembers'] });
159
+ */
160
+ edit(options: RESTUpdateRoleBody & {
161
+ permissions?: string | PermissionResolvable;
162
+ }): Promise<Role>;
163
+ /**
164
+ * Delete this role.
165
+ * Requires Manage Roles permission.
166
+ */
167
+ delete(): Promise<void>;
168
+ }
169
+
170
+ /** Role ID or Role object for add/remove. */
171
+ type RoleResolvable = string | Role;
172
+ /**
173
+ * Manages a guild member's roles with add/remove/set and a cache of Role objects.
174
+ * Discord.js parity: member.roles.add(), member.roles.remove(), member.roles.set(), member.roles.cache
175
+ *
176
+ * @discordJsCompat https://discord.js.org/docs/packages/discord.js/main/GuildMemberRoleManager
177
+ * @example
178
+ * // Add a role (Discord.js style)
179
+ * await member.roles.add(roleId);
180
+ *
181
+ * @example
182
+ * // Remove a role
183
+ * await member.roles.remove(roleId);
184
+ *
185
+ * @example
186
+ * // Replace all roles
187
+ * await member.roles.set(['roleId1', 'roleId2']);
188
+ *
189
+ * @example
190
+ * // Check if member has a role
191
+ * if (member.roles.cache.has(roleId)) { ... }
192
+ */
193
+ declare class GuildMemberRoleManager {
194
+ private readonly member;
195
+ private _roleIds;
196
+ constructor(member: GuildMember, initialRoleIds?: string[]);
197
+ /** Role IDs for this member. Used by permissions; prefer cache for Role objects. */
198
+ get roleIds(): readonly string[];
199
+ /** Check if the member has a role. Discord.js parity: member.roles.cache.has(roleId) */
200
+ has(roleOrId: RoleResolvable): boolean;
201
+ /**
202
+ * Collection of Role objects for this member's roles (from guild.roles).
203
+ * Discord.js parity: member.roles.cache
204
+ * @discordJsCompat https://discord.js.org/docs/packages/discord.js/main/GuildMemberRoleManager
205
+ */
206
+ get cache(): Collection<string, Role>;
207
+ /** Resolve role ID from RoleResolvable. */
208
+ private _resolveId;
209
+ /**
210
+ * Add a role to this member.
211
+ * Discord.js parity: member.roles.add(roleId)
212
+ * Requires Manage Roles permission.
213
+ * @discordJsCompat https://discord.js.org/docs/packages/discord.js/main/GuildMemberRoleManager
214
+ */
215
+ add(roleOrId: RoleResolvable): Promise<void>;
216
+ /**
217
+ * Remove a role from this member.
218
+ * Discord.js parity: member.roles.remove(roleId)
219
+ * Requires Manage Roles permission.
220
+ * @discordJsCompat https://discord.js.org/docs/packages/discord.js/main/GuildMemberRoleManager
221
+ */
222
+ remove(roleOrId: RoleResolvable): Promise<void>;
223
+ /**
224
+ * Replace all roles for this member. PATCH /guilds/{id}/members/{userId}
225
+ * Discord.js parity: member.roles.set(roleIds)
226
+ * Requires Manage Roles permission.
227
+ * @discordJsCompat https://discord.js.org/docs/packages/discord.js/main/GuildMemberRoleManager
228
+ */
229
+ set(roleIds: string[]): Promise<void>;
230
+ /**
231
+ * Update internal role IDs from API response. Called by GuildMember.edit().
232
+ * @internal
233
+ */
234
+ _patch(roleIds: string[]): void;
235
+ }
236
+
237
+ /** Represents a member of a guild. */
238
+ declare class GuildMember extends Base {
239
+ readonly client: Client;
240
+ readonly id: string;
241
+ readonly user: User;
242
+ readonly guild: Guild;
243
+ nick: string | null;
244
+ /**
245
+ * Role manager with add/remove/set and cache. Discord.js parity: member.roles.add(), member.roles.cache
246
+ * @discordJsCompat https://discord.js.org/docs/packages/discord.js/main/GuildMemberRoleManager
247
+ */
248
+ readonly roles: GuildMemberRoleManager;
249
+ readonly joinedAt: Date;
250
+ communicationDisabledUntil: Date | null;
251
+ readonly mute: boolean;
252
+ readonly deaf: boolean;
253
+ readonly avatar: string | null;
254
+ readonly banner: string | null;
255
+ readonly accentColor: number | null;
256
+ readonly profileFlags: number | null;
257
+ /** @param data - API guild member from GET /guilds/{id}/members or GET /guilds/{id}/members/{user_id} */
258
+ constructor(client: Client, data: APIGuildMember & {
259
+ guild_id?: string;
260
+ }, guild: Guild);
261
+ /** Nickname, or global name, or username. */
262
+ get displayName(): string;
263
+ /**
264
+ * Get the guild-specific avatar URL for this member.
265
+ * Returns null if the member has no guild avatar (use displayAvatarURL for fallback).
266
+ */
267
+ avatarURL(options?: {
268
+ size?: number;
269
+ extension?: string;
270
+ }): string | null;
271
+ /**
272
+ * Get the avatar URL to display for this member.
273
+ * Uses guild-specific avatar if set, otherwise falls back to the user's avatar.
274
+ */
275
+ displayAvatarURL(options?: {
276
+ size?: number;
277
+ extension?: string;
278
+ }): string;
279
+ /**
280
+ * Get the guild-specific banner URL for this member.
281
+ * Returns null if the member has no guild banner.
282
+ */
283
+ bannerURL(options?: {
284
+ size?: number;
285
+ extension?: string;
286
+ }): string | null;
287
+ /**
288
+ * Add a role to this member.
289
+ * Prefer member.roles.add(roleId) for Discord.js parity.
290
+ * @param roleId - The role ID to add
291
+ * Requires Manage Roles permission.
292
+ */
293
+ addRole(roleId: string): Promise<void>;
294
+ /**
295
+ * Remove a role from this member.
296
+ * Prefer member.roles.remove(roleId) for Discord.js parity.
297
+ * @param roleId - The role ID to remove
298
+ * Requires Manage Roles permission.
299
+ */
300
+ removeRole(roleId: string): Promise<void>;
301
+ /**
302
+ * Edit this guild member. PATCH /guilds/{id}/members/{userId} or /members/@me for the bot.
303
+ * For @me: nick, avatar, banner, bio, pronouns, accent_color, profile_flags, mute, deaf,
304
+ * communication_disabled_until, timeout_reason, channel_id, connection_id.
305
+ * For other members: same plus roles (array of role IDs).
306
+ */
307
+ edit(options: {
308
+ nick?: string | null;
309
+ roles?: string[];
310
+ avatar?: string | null;
311
+ banner?: string | null;
312
+ bio?: string | null;
313
+ pronouns?: string | null;
314
+ accent_color?: number | null;
315
+ profile_flags?: number | null;
316
+ mute?: boolean;
317
+ deaf?: boolean;
318
+ communication_disabled_until?: string | null;
319
+ timeout_reason?: string | null;
320
+ channel_id?: string | null;
321
+ connection_id?: string | null;
322
+ }): Promise<this>;
323
+ /**
324
+ * Get the member's guild-level permissions (from roles only, no channel overwrites).
325
+ * Use this for server-wide permission checks (e.g. ban, kick, manage roles).
326
+ * @returns Object with has(permission) to check specific permissions
327
+ * @example
328
+ * const perms = member.permissions;
329
+ * if (perms.has(PermissionFlags.BanMembers)) { ... }
330
+ */
331
+ get permissions(): BitField<"CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageEmojisAndStickers" | "ManageExpressions" | "UseExternalStickers" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion">;
332
+ /**
333
+ * Compute the member's effective permissions in a guild channel.
334
+ * Applies role permissions and channel overwrites.
335
+ * @param channel - The guild channel to check permissions for
336
+ * @returns Object with has(permission) to check specific permissions
337
+ * @example
338
+ * const perms = member.permissionsIn(channel);
339
+ * if (perms.has(PermissionFlags.SendMessages)) { ... }
340
+ */
341
+ permissionsIn(channel: GuildChannel): BitField<"CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageEmojisAndStickers" | "ManageExpressions" | "UseExternalStickers" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion">;
342
+ /**
343
+ * Move this member to a different voice channel or disconnect them from voice.
344
+ * Requires Move Members permission.
345
+ * @param channelId - The voice channel ID to move the member to, or null to disconnect
346
+ * @param connectionId - Optional connection ID for the specific voice session (usually not needed)
347
+ * @returns Promise that resolves when the member has been moved
348
+ * @example
349
+ * // Move member to a different voice channel
350
+ * await member.move('123456789012345678');
351
+ *
352
+ * // Disconnect member from voice
353
+ * await member.move(null);
354
+ */
355
+ move(channelId: string | null, connectionId?: string | null): Promise<void>;
356
+ private _computeBasePermissions;
357
+ }
358
+
359
+ /**
360
+ * Manages guild members with a Collection-like API.
361
+ * Extends Collection so you can use .get(), .set(), .filter(), etc.
362
+ * Provides guild.members.me for Discord.js parity.
363
+ *
364
+ * @discordJsCompat https://discord.js.org/docs/packages/discord.js/main/GuildMemberManager
365
+ */
366
+ declare class GuildMemberManager extends Collection<string, GuildMember> {
367
+ private readonly guild;
368
+ constructor(guild: Guild);
369
+ /**
370
+ * Get a guild member from cache or fetch from the API if not present.
371
+ * Convenience helper to avoid repeating `guild.members.get(userId) ?? (await guild.fetchMember(userId))`.
372
+ * @param userId - Snowflake of the user
373
+ * @returns The guild member
374
+ * @throws FluxerError with MEMBER_NOT_FOUND if user is not in the guild (404)
375
+ * @example
376
+ * const member = await guild.members.resolve(userId);
377
+ * console.log(member.displayName);
378
+ */
379
+ resolve(userId: string): Promise<GuildMember>;
380
+ /**
381
+ * The current bot user as a GuildMember in this guild.
382
+ * Returns null if the bot's member is not cached or client.user is null.
383
+ * Use fetchMe() to load the bot's member when not cached.
384
+ *
385
+ * @discordJsCompat https://discord.js.org/docs/packages/discord.js/main/GuildMemberManager
386
+ * @example
387
+ * const perms = guild.members.me?.permissions;
388
+ * if (perms?.has(PermissionFlags.BanMembers)) { ... }
389
+ */
390
+ get me(): GuildMember | null;
391
+ /**
392
+ * Fetch the current bot user as a GuildMember in this guild.
393
+ * Caches the result in guild.members.
394
+ *
395
+ * @throws Error if client.user is null (client not ready)
396
+ * @example
397
+ * const me = await guild.members.fetchMe();
398
+ * console.log(me.displayName);
399
+ */
400
+ fetchMe(): Promise<GuildMember>;
401
+ /**
402
+ * Fetch guild members with pagination. GET /guilds/{id}/members.
403
+ * @param options - limit (1-1000), after (user ID for pagination)
404
+ * @returns Array of GuildMember objects (cached in guild.members)
405
+ */
406
+ fetch(options?: {
407
+ limit?: number;
408
+ after?: string;
409
+ }): Promise<GuildMember[]>;
410
+ }
411
+
412
+ /** File data for webhook attachment uploads. Use `data` for buffers or `url` to fetch from a URL. */
413
+ type WebhookFileData = MessageFileData;
414
+ /** Attachment metadata for webhook file uploads (id matches FormData index). */
415
+ interface WebhookAttachmentMeta {
416
+ id: number;
417
+ filename: string;
418
+ title?: string | null;
419
+ description?: string | null;
420
+ /** MessageAttachmentFlags: IS_SPOILER (8), CONTAINS_EXPLICIT_MEDIA (16), IS_ANIMATED (32) */
421
+ flags?: number;
422
+ }
423
+ /** Options for sending a message via webhook. Aligns with WebhookMessageRequest in the API. */
424
+ interface WebhookSendOptions {
425
+ /** Message text content (up to 2000 characters) */
426
+ content?: string;
427
+ /** Embed objects. Use EmbedBuilder or APIEmbed; EmbedBuilder is serialized automatically. */
428
+ embeds?: (APIEmbed | EmbedBuilder)[];
429
+ /** Override the webhook's default username for this message */
430
+ username?: string;
431
+ /** Override the webhook's default avatar URL for this message */
432
+ avatar_url?: string;
433
+ /** Text-to-speech */
434
+ tts?: boolean;
435
+ /** File attachments. When present, uses multipart/form-data (same as channel.send). */
436
+ files?: WebhookFileData[];
437
+ /** Attachment metadata for files (id = index). Use when files are provided. */
438
+ attachments?: WebhookAttachmentMeta[];
439
+ }
440
+ /**
441
+ * Represents a Discord/Fluxer webhook. Supports creating, fetching, sending, and deleting.
442
+ * The token is only available when the webhook was created; fetched webhooks cannot send messages.
443
+ */
444
+ declare class Webhook extends Base {
445
+ readonly client: Client;
446
+ readonly id: string;
447
+ readonly guildId: string;
448
+ channelId: string;
449
+ name: string;
450
+ avatar: string | null;
451
+ /** Present only when webhook was created via createWebhook(); not returned when fetching. */
452
+ readonly token: string | null;
453
+ /** User who created the webhook. */
454
+ readonly user: User;
455
+ /** @param data - API webhook from POST /channels/{id}/webhooks (has token) or GET /webhooks/{id} (no token) */
456
+ constructor(client: Client, data: APIWebhook & {
457
+ token?: string | null;
458
+ });
459
+ /**
460
+ * Get the URL for this webhook's avatar.
461
+ * Returns null if the webhook has no custom avatar.
462
+ */
463
+ avatarURL(options?: {
464
+ size?: number;
465
+ extension?: string;
466
+ }): string | null;
467
+ /** Delete this webhook. Requires bot token with Manage Webhooks permission. */
468
+ delete(): Promise<void>;
469
+ /**
470
+ * Edit this webhook. With token: name and avatar only. Without token (bot auth): name, avatar, and channel_id.
471
+ * @param options - Fields to update (name, avatar, channel_id when using bot auth)
472
+ * @returns This webhook instance with updated fields
473
+ */
474
+ edit(options: APIWebhookUpdateRequest | APIWebhookTokenUpdateRequest): Promise<Webhook>;
475
+ /**
476
+ * Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
477
+ * @param options - Text content or object with content, embeds, username, avatar_url, tts, files, attachments
478
+ * @param wait - If true, waits for the API and returns the created Message; otherwise returns void (204)
479
+ * @throws Error if token is not available
480
+ * @example
481
+ * await webhook.send('Hello!');
482
+ * await webhook.send({ embeds: [embed] });
483
+ * await webhook.send({ content: 'File attached', files: [{ name: 'data.txt', data: buffer }] });
484
+ * const msg = await webhook.send({ content: 'Hi' }, true);
485
+ */
486
+ send(options: string | WebhookSendOptions, wait?: boolean): Promise<Message | undefined>;
487
+ /**
488
+ * Edit a message previously sent by this webhook.
489
+ * Requires the webhook token.
490
+ * @param messageId - The ID of the message to edit
491
+ * @param options - Fields to update (content, embeds, attachments)
492
+ * @returns The updated Message
493
+ * @throws Error if token is not available
494
+ */
495
+ editMessage(messageId: string, options: APIWebhookEditMessageRequest): Promise<Message>;
496
+ /**
497
+ * Fetch a message sent by this webhook.
498
+ * Requires the webhook token.
499
+ * @param messageId - The ID of the message to fetch
500
+ * @returns The message
501
+ * @throws Error if token is not available
502
+ */
503
+ fetchMessage(messageId: string): Promise<Message>;
504
+ /**
505
+ * Delete a message sent by this webhook.
506
+ * Requires the webhook token.
507
+ * @param messageId - The ID of the message to delete
508
+ * @throws Error if token is not available
509
+ */
510
+ deleteMessage(messageId: string): Promise<void>;
511
+ /**
512
+ * Fetch a webhook by ID using bot auth.
513
+ * @param client - The client instance
514
+ * @param webhookId - The webhook ID
515
+ * @returns Webhook without token (cannot send)
516
+ */
517
+ static fetch(client: Client, webhookId: string): Promise<Webhook>;
518
+ /**
519
+ * Create a Webhook instance from an ID and token (e.g. from a stored webhook URL).
520
+ * @param client - The client instance
521
+ * @param webhookId - The webhook ID
522
+ * @param token - The webhook token (from createWebhook or stored)
523
+ * @param options - Optional channelId, guildId, name for display
524
+ */
525
+ static fromToken(client: Client, webhookId: string, token: string, options?: {
526
+ channelId?: string;
527
+ guildId?: string;
528
+ name?: string;
529
+ }): Webhook;
530
+ }
531
+
532
+ /** Represents a ban in a guild. */
533
+ declare class GuildBan extends Base {
534
+ readonly client: Client;
535
+ readonly guildId: string;
536
+ readonly user: User;
537
+ readonly reason: string | null;
538
+ /** ISO timestamp when a temporary ban expires. Null for permanent bans. */
539
+ readonly expiresAt: string | null;
540
+ /** @param data - API ban from GET /guilds/{id}/bans or gateway GUILD_BAN_ADD */
541
+ constructor(client: Client, data: APIBan & {
542
+ guild_id?: string;
543
+ }, guildId: string);
544
+ /**
545
+ * Remove this ban (unban the user).
546
+ * Requires Ban Members permission.
547
+ */
548
+ unban(): Promise<void>;
549
+ }
550
+
551
+ /** Represents a custom emoji in a guild. */
552
+ declare class GuildEmoji extends Base {
553
+ readonly client: Client;
554
+ readonly id: string;
555
+ readonly guildId: string;
556
+ name: string;
557
+ readonly animated: boolean;
558
+ /** @param data - API emoji from GET /guilds/{id}/emojis or guild emoji events */
559
+ constructor(client: Client, data: APIEmoji & {
560
+ guild_id?: string;
561
+ }, guildId: string);
562
+ /** CDN URL for this emoji image. */
563
+ get url(): string;
564
+ /** Emoji identifier for use in reactions: `name:id` */
565
+ get identifier(): string;
566
+ /** Delete this emoji. Requires Manage Emojis and Stickers permission. */
567
+ delete(): Promise<void>;
568
+ /**
569
+ * Edit this emoji's name.
570
+ * Requires Manage Emojis and Stickers permission.
571
+ */
572
+ edit(options: {
573
+ name: string;
574
+ }): Promise<GuildEmoji>;
575
+ }
576
+
577
+ /** Represents a custom sticker in a guild. */
578
+ declare class GuildSticker extends Base {
579
+ readonly client: Client;
580
+ readonly id: string;
581
+ readonly guildId: string;
582
+ name: string;
583
+ description: string;
584
+ readonly tags: string[];
585
+ readonly animated: boolean;
586
+ /** @param data - API sticker from GET /guilds/{id}/stickers or guild sticker events */
587
+ constructor(client: Client, data: APISticker & {
588
+ guild_id?: string;
589
+ }, guildId: string);
590
+ /** CDN URL for this sticker image. */
591
+ get url(): string;
592
+ /** Delete this sticker. Requires Manage Emojis and Stickers permission. */
593
+ delete(): Promise<void>;
594
+ /**
595
+ * Edit this sticker's name and/or description.
596
+ * Requires Manage Emojis and Stickers permission.
597
+ */
598
+ edit(options: {
599
+ name?: string;
600
+ description?: string;
601
+ }): Promise<GuildSticker>;
602
+ }
603
+
604
+ /** Represents an invite to a guild or channel. */
605
+ declare class Invite extends Base {
606
+ readonly client: Client;
607
+ readonly code: string;
608
+ readonly type: number;
609
+ readonly guild: APIGuildPartial;
610
+ readonly channel: APIChannelPartial;
611
+ readonly inviter: User | null;
612
+ readonly memberCount: number | null;
613
+ readonly presenceCount: number | null;
614
+ readonly expiresAt: string | null;
615
+ readonly temporary: boolean | null;
616
+ readonly createdAt: string | null;
617
+ readonly uses: number | null;
618
+ readonly maxUses: number | null;
619
+ readonly maxAge: number | null;
620
+ /**
621
+ * Normalize an invite input into a raw invite code.
622
+ * Accepts either an invite code (e.g. "abc123") or a URL (e.g. "https://fluxer.gg/abc123").
623
+ */
624
+ private static normalizeCode;
625
+ /** @param data - API invite from GET /invites/{code}, channel/guild invite list, or gateway INVITE_CREATE */
626
+ constructor(client: Client, data: APIInvite);
627
+ /**
628
+ * Fetch invite information by code or URL.
629
+ * Does not consume or accept the invite.
630
+ */
631
+ static fetch(client: Client, codeOrUrl: string): Promise<Invite>;
632
+ /** Full invite URL (https://fluxer.gg/{code} or instance-specific). */
633
+ get url(): string;
634
+ /**
635
+ * Resolve the guild from cache if available.
636
+ * @returns The guild, or null if not cached
637
+ */
638
+ getGuild(): Guild | null;
639
+ /**
640
+ * Delete this invite.
641
+ * Requires Manage Guild or Create Instant Invite permission.
642
+ */
643
+ delete(): Promise<void>;
644
+ }
645
+
646
+ /** Represents a Fluxer guild (server). */
647
+ declare class Guild extends Base {
648
+ readonly client: Client;
649
+ readonly id: string;
650
+ name: string;
651
+ icon: string | null;
652
+ banner: string | null;
653
+ readonly ownerId: string;
654
+ /** Invite splash image hash. Null if none. */
655
+ splash: string | null;
656
+ /** Custom vanity URL code (e.g. fluxer.gg/code). Null if none. */
657
+ vanityURLCode: string | null;
658
+ /** Enabled guild features. */
659
+ features: GuildFeature[];
660
+ verificationLevel: GuildVerificationLevel;
661
+ defaultMessageNotifications: DefaultMessageNotifications;
662
+ explicitContentFilter: GuildExplicitContentFilter;
663
+ /** AFK voice channel ID. Null if none. */
664
+ afkChannelId: string | null;
665
+ /** AFK timeout in seconds. */
666
+ afkTimeout: number;
667
+ /** System messages channel ID. Null if none. */
668
+ systemChannelId: string | null;
669
+ /** Rules/guidelines channel ID. Null if none. */
670
+ rulesChannelId: string | null;
671
+ nsfwLevel: number;
672
+ mfaLevel: GuildMFALevel;
673
+ /** Banner image width. Optional. */
674
+ bannerWidth?: number | null;
675
+ /** Banner image height. Optional. */
676
+ bannerHeight?: number | null;
677
+ /** Splash image width. Optional. */
678
+ splashWidth?: number | null;
679
+ /** Splash image height. Optional. */
680
+ splashHeight?: number | null;
681
+ members: GuildMemberManager;
682
+ channels: Collection<string, GuildChannel>;
683
+ roles: Collection<string, Role>;
684
+ emojis: Collection<string, GuildEmoji>;
685
+ stickers: Collection<string, GuildSticker>;
686
+ /** @param data - API guild from GET /guilds/{id} or gateway GUILD_CREATE */
687
+ constructor(client: Client, data: APIGuild & {
688
+ roles?: APIRole[];
689
+ ownerId?: string;
690
+ });
691
+ /** Get the guild icon URL, or null if no icon. */
692
+ iconURL(options?: {
693
+ size?: number;
694
+ }): string | null;
695
+ /** Get the guild banner URL, or null if no banner. */
696
+ bannerURL(options?: {
697
+ size?: number;
698
+ }): string | null;
699
+ /** Get the guild splash (invite background) URL, or null if no splash. */
700
+ splashURL(options?: {
701
+ size?: number;
702
+ }): string | null;
703
+ /**
704
+ * Add a role to a member by user ID. Does not require fetching the member first.
705
+ * @param userId - The user ID of the member
706
+ * @param roleId - The role ID to add (or use guild.resolveRoleId for mention/name resolution)
707
+ * Requires Manage Roles permission.
708
+ */
709
+ addRoleToMember(userId: string, roleId: string): Promise<void>;
710
+ /**
711
+ * Remove a role from a member by user ID. Does not require fetching the member first.
712
+ * @param userId - The user ID of the member
713
+ * @param roleId - The role ID to remove
714
+ * Requires Manage Roles permission.
715
+ */
716
+ removeRoleFromMember(userId: string, roleId: string): Promise<void>;
717
+ /**
718
+ * Create a role in this guild.
719
+ * Requires Manage Roles permission.
720
+ * @param options - Role data (permissions accepts PermissionResolvable for convenience)
721
+ * @returns The created role
722
+ * @example
723
+ * const role = await guild.createRole({ name: 'Mod', permissions: ['KickMembers', 'BanMembers'] });
724
+ */
725
+ createRole(options: RESTCreateRoleBody & {
726
+ permissions?: string | PermissionResolvable;
727
+ }): Promise<Role>;
728
+ /**
729
+ * Fetch all roles in this guild.
730
+ * @returns Array of Role objects (cached in guild.roles)
731
+ */
732
+ fetchRoles(): Promise<Role[]>;
733
+ /**
734
+ * Fetch a role by ID.
735
+ * @param roleId - The role ID to fetch
736
+ * @returns The role
737
+ * @throws FluxerError with ROLE_NOT_FOUND if role does not exist (404)
738
+ */
739
+ fetchRole(roleId: string): Promise<Role>;
740
+ /**
741
+ * Resolve a role ID from an argument (role mention, raw ID, or name).
742
+ * Fetches guild roles if name is provided.
743
+ * @param arg - Role mention (@role), role ID, or role name
744
+ * @returns The role ID, or null if not found
745
+ */
746
+ resolveRoleId(arg: string): Promise<string | null>;
747
+ /**
748
+ * Ban a user from this guild.
749
+ * @param userId - The user ID to ban
750
+ * @param options - Optional reason, delete_message_days (0–7), and ban_duration_seconds (temporary ban).
751
+ * ban_duration_seconds: 0 = permanent, or use 3600, 43200, 86400, 259200, 432000, 604800, 1209600, 2592000.
752
+ * Requires Ban Members permission.
753
+ */
754
+ ban(userId: string, options?: {
755
+ reason?: string;
756
+ delete_message_days?: number;
757
+ ban_duration_seconds?: number;
758
+ }): Promise<void>;
759
+ /**
760
+ * Fetch guild bans. Requires Ban Members permission.
761
+ * @returns List of GuildBan objects
762
+ */
763
+ fetchBans(): Promise<GuildBan[]>;
764
+ /**
765
+ * Remove a ban (unban a user).
766
+ * @param userId - The user ID to unban
767
+ * Requires Ban Members permission.
768
+ */
769
+ unban(userId: string): Promise<void>;
770
+ /**
771
+ * Kick a member from this guild.
772
+ * @param userId - The user ID to kick
773
+ * Requires Kick Members permission.
774
+ */
775
+ kick(userId: string): Promise<void>;
776
+ /**
777
+ * Fetch a guild member by user ID.
778
+ * @param userId - The user ID of the member to fetch
779
+ * @returns The guild member
780
+ * @throws FluxerError with MEMBER_NOT_FOUND if user is not in the guild (404)
781
+ * @throws FluxerError with cause for permission denied (403) or other REST errors
782
+ */
783
+ fetchMember(userId: string): Promise<GuildMember>;
784
+ /**
785
+ * Fetch guild audit logs. Requires View Audit Log permission.
786
+ * @param options - Optional limit, before, after, user_id, action_type for filtering
787
+ */
788
+ fetchAuditLogs(options?: {
789
+ limit?: number;
790
+ before?: string;
791
+ after?: string;
792
+ userId?: string;
793
+ actionType?: number;
794
+ }): Promise<APIGuildAuditLog>;
795
+ /** Fetch all webhooks in this guild. Returned webhooks do not include the token (cannot send). */
796
+ fetchWebhooks(): Promise<Webhook[]>;
797
+ /**
798
+ * Fetch all invites in this guild.
799
+ * Requires Manage Guild permission.
800
+ */
801
+ fetchInvites(): Promise<Invite[]>;
802
+ /**
803
+ * Fetch a guild invite by code or URL.
804
+ * Convenience wrapper for Invite.fetch(client, codeOrUrl).
805
+ */
806
+ fetchInvite(codeOrUrl: string): Promise<Invite>;
807
+ /**
808
+ * Create a channel in this guild.
809
+ * @param data - Channel data: type (0=text, 2=voice, 4=category, 5=link), name, and optional parent_id, topic, bitrate, user_limit, nsfw, permission_overwrites
810
+ * Requires Manage Channels permission.
811
+ */
812
+ createChannel(data: {
813
+ type: 0 | 2 | 4 | 5;
814
+ name: string;
815
+ parent_id?: string | null;
816
+ topic?: string | null;
817
+ bitrate?: number | null;
818
+ user_limit?: number | null;
819
+ nsfw?: boolean;
820
+ permission_overwrites?: Array<{
821
+ id: string;
822
+ type: number;
823
+ allow: string;
824
+ deny: string;
825
+ }>;
826
+ }): Promise<GuildChannel>;
827
+ /**
828
+ * Fetch all channels in this guild.
829
+ * @returns Array of GuildChannel objects (cached in guild.channels and client.channels)
830
+ */
831
+ fetchChannels(): Promise<GuildChannel[]>;
832
+ /**
833
+ * Edit this guild. PATCH /guilds/{id}.
834
+ * Requires guild owner or Administrator.
835
+ */
836
+ edit(options: {
837
+ name?: string;
838
+ icon?: string | null;
839
+ system_channel_id?: string | null;
840
+ system_channel_flags?: number;
841
+ afk_channel_id?: string | null;
842
+ afk_timeout?: number;
843
+ default_message_notifications?: DefaultMessageNotifications;
844
+ verification_level?: GuildVerificationLevel;
845
+ mfa_level?: GuildMFALevel;
846
+ explicit_content_filter?: GuildExplicitContentFilter;
847
+ banner?: string | null;
848
+ splash?: string | null;
849
+ embed_splash?: string | null;
850
+ splash_card_alignment?: string;
851
+ features?: GuildFeature[];
852
+ }): Promise<this>;
853
+ /**
854
+ * Delete this guild. POST /guilds/{id}/delete.
855
+ * Must be the guild owner.
856
+ */
857
+ delete(): Promise<void>;
858
+ /**
859
+ * Fetch vanity URL for this guild. GET /guilds/{id}/vanity-url.
860
+ * Requires Manage Guild permission.
861
+ */
862
+ fetchVanityURL(): Promise<APIVanityURL>;
863
+ /**
864
+ * Transfer guild ownership to another user. POST /guilds/{id}/transfer-ownership.
865
+ * Must be the guild owner.
866
+ */
867
+ transferOwnership(newOwnerId: string, password?: string): Promise<void>;
868
+ /**
869
+ * Set text channel flexible names feature. PATCH /guilds/{id}/text-channel-flexible-names.
870
+ */
871
+ setTextChannelFlexibleNames(enabled: boolean): Promise<this>;
872
+ /**
873
+ * Set detached banner feature. PATCH /guilds/{id}/detached-banner.
874
+ */
875
+ setDetachedBanner(enabled: boolean): Promise<this>;
876
+ /**
877
+ * Set disallow unclaimed accounts. PATCH /guilds/{id}/disallow-unclaimed-accounts.
878
+ */
879
+ setDisallowUnclaimedAccounts(enabled: boolean): Promise<this>;
880
+ /**
881
+ * Update role positions. PATCH /guilds/{id}/roles.
882
+ * @param updates - Array of { id, position? }
883
+ */
884
+ setRolePositions(updates: Array<{
885
+ id: string;
886
+ position?: number;
887
+ }>): Promise<APIRole[]>;
888
+ /**
889
+ * Update role hoist positions. PATCH /guilds/{id}/roles/hoist-positions.
890
+ */
891
+ setRoleHoistPositions(updates: Array<{
892
+ id: string;
893
+ hoist_position?: number;
894
+ }>): Promise<APIRole[]>;
895
+ /**
896
+ * Reset role hoist positions. DELETE /guilds/{id}/roles/hoist-positions.
897
+ */
898
+ resetRoleHoistPositions(): Promise<APIRole[]>;
899
+ /**
900
+ * Update channel positions.
901
+ * @param updates - Array of { id, position?, parent_id?, lock_permissions? }
902
+ * Requires Manage Channels permission.
903
+ */
904
+ setChannelPositions(updates: Array<{
905
+ id: string;
906
+ position?: number;
907
+ parent_id?: string | null;
908
+ lock_permissions?: boolean;
909
+ }>): Promise<void>;
910
+ /**
911
+ * Fetch all emojis in this guild.
912
+ * @returns Array of GuildEmoji objects (cached in guild.emojis)
913
+ */
914
+ fetchEmojis(): Promise<GuildEmoji[]>;
915
+ /**
916
+ * Fetch a single emoji by ID.
917
+ * @param emojiId - The emoji ID to fetch
918
+ * @returns The guild emoji
919
+ * @throws FluxerError if emoji not found (404)
920
+ */
921
+ fetchEmoji(emojiId: string): Promise<GuildEmoji>;
922
+ /**
923
+ * Fetch all stickers in this guild.
924
+ * @returns Array of GuildSticker objects (cached in guild.stickers)
925
+ */
926
+ fetchStickers(): Promise<GuildSticker[]>;
927
+ /**
928
+ * Fetch a single sticker by ID.
929
+ * @param stickerId - The sticker ID to fetch
930
+ */
931
+ fetchSticker(stickerId: string): Promise<GuildSticker>;
932
+ /**
933
+ * Bulk create emojis. POST /guilds/{id}/emojis/bulk.
934
+ * @param emojis - Array of { name, image } (base64), 1-50 emojis
935
+ * @returns Array of created GuildEmoji objects
936
+ */
937
+ createEmojisBulk(emojis: Array<{
938
+ name: string;
939
+ image: string;
940
+ }>): Promise<GuildEmoji[]>;
941
+ /**
942
+ * Bulk create stickers. POST /guilds/{id}/stickers/bulk.
943
+ * @param stickers - Array of { name, image, description?, tags? }, 1-50 stickers
944
+ * @returns Array of created GuildSticker objects
945
+ */
946
+ createStickersBulk(stickers: Array<{
947
+ name: string;
948
+ image: string;
949
+ description?: string;
950
+ tags?: string[];
951
+ }>): Promise<GuildSticker[]>;
952
+ }
953
+
954
+ /** Represents a reaction added to or removed from a message. */
955
+ declare class MessageReaction extends Base {
956
+ readonly client: Client;
957
+ readonly messageId: string;
958
+ readonly channelId: string;
959
+ readonly guildId: string | null;
960
+ readonly emoji: GatewayReactionEmoji;
961
+ /** Raw gateway payload for low-level access. */
962
+ readonly _data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData;
963
+ constructor(client: Client, data: GatewayMessageReactionAddDispatchData | GatewayMessageReactionRemoveDispatchData);
964
+ /** Emoji as a string: unicode or "name:id" for custom. */
965
+ get emojiIdentifier(): string;
966
+ /** Guild where this reaction was added. Resolved from cache; null for DMs or if not cached. */
967
+ get guild(): Guild | null;
968
+ /**
969
+ * Fetch the message this reaction belongs to.
970
+ * Use when you need to edit, delete, or otherwise interact with the message.
971
+ * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
972
+ */
973
+ fetchMessage(): Promise<Message>;
974
+ }
975
+
976
+ interface ReactionCollectorOptions {
977
+ /** Filter function. Return true to collect the reaction. */
978
+ filter?: (reaction: MessageReaction, user: User) => boolean;
979
+ /** Max duration in ms. Collector stops when time expires. */
980
+ time?: number;
981
+ /** Max reactions to collect. Collector stops when limit reached. */
982
+ max?: number;
983
+ }
984
+ type ReactionCollectorEndReason = 'time' | 'limit' | 'user';
985
+ interface CollectedReaction {
986
+ reaction: MessageReaction;
987
+ user: User;
988
+ }
989
+ interface ReactionCollectorEvents {
990
+ collect: [reaction: MessageReaction, user: User];
991
+ end: [collected: Collection<string, CollectedReaction>, reason: ReactionCollectorEndReason];
992
+ }
993
+ /**
994
+ * Collects reactions on a message. Use message.createReactionCollector().
995
+ * @example
996
+ * const collector = message.createReactionCollector({ filter: (r, u) => u.id === userId, time: 10000 });
997
+ * collector.on('collect', (reaction, user) => console.log(user.username, 'reacted', reaction.emoji.name));
998
+ * collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
999
+ */
1000
+ declare class ReactionCollector extends EventEmitter {
1001
+ readonly client: Client;
1002
+ readonly messageId: string;
1003
+ readonly channelId: string;
1004
+ readonly options: Required<ReactionCollectorOptions>;
1005
+ readonly collected: Collection<string, CollectedReaction>;
1006
+ private _timeout;
1007
+ private _ended;
1008
+ private _listener;
1009
+ constructor(client: Client, messageId: string, channelId: string, options?: ReactionCollectorOptions);
1010
+ stop(reason?: ReactionCollectorEndReason): void;
1011
+ on<K extends keyof ReactionCollectorEvents>(event: K, listener: (...args: ReactionCollectorEvents[K]) => void): this;
1012
+ emit<K extends keyof ReactionCollectorEvents>(event: K, ...args: ReactionCollectorEvents[K]): boolean;
1013
+ }
1014
+
1015
+ /** Options for editing a message (content and/or embeds). */
1016
+ interface MessageEditOptions {
1017
+ /** New text content */
1018
+ content?: string;
1019
+ /** New embeds (replaces existing) */
1020
+ embeds?: (APIEmbed | EmbedBuilder)[];
1021
+ }
1022
+ type MessagePayload = {
1023
+ files?: ResolvedMessageFile[];
1024
+ body: SendBodyResult & {
1025
+ message_reference?: APIMessageReference;
1026
+ flags?: number;
1027
+ };
1028
+ };
1029
+ /** Options for message.reply() — ping toggle and reply-to-different-message. */
1030
+ interface ReplyOptions {
1031
+ /** Whether to ping the replied-to user (default true). Use false to suppress the mention notification. */
1032
+ ping?: boolean;
1033
+ /** Reply to a different message instead of this one. Default: this message. */
1034
+ replyTo?: Message | {
1035
+ channelId: string;
1036
+ messageId: string;
1037
+ };
1038
+ }
1039
+
1040
+ /** Represents a message in a channel. */
1041
+ declare class Message extends Base {
1042
+ readonly client: Client;
1043
+ readonly id: string;
1044
+ readonly channelId: string;
1045
+ readonly guildId: string | null;
1046
+ readonly author: User;
1047
+ content: string;
1048
+ readonly createdAt: Date;
1049
+ readonly editedAt: Date | null;
1050
+ pinned: boolean;
1051
+ readonly attachments: Collection<string, APIMessageAttachment>;
1052
+ readonly type: MessageType;
1053
+ readonly flags: number;
1054
+ readonly mentionEveryone: boolean;
1055
+ readonly tts: boolean;
1056
+ readonly embeds: APIEmbed[];
1057
+ readonly stickers: APIMessageSticker[];
1058
+ readonly reactions: APIMessageReaction[];
1059
+ readonly messageReference: APIMessageReference | null;
1060
+ readonly messageSnapshots: APIMessageSnapshot[];
1061
+ readonly call: APIMessageCall | null;
1062
+ readonly referencedMessage: Message | null;
1063
+ /** Webhook ID if this message was sent via webhook. Null otherwise. */
1064
+ readonly webhookId: string | null;
1065
+ /** Users mentioned in this message. */
1066
+ readonly mentions: User[];
1067
+ /** Role IDs mentioned in this message. */
1068
+ readonly mentionRoles: string[];
1069
+ /** Client-side nonce for acknowledgment. Null if not provided. */
1070
+ readonly nonce: string | null;
1071
+ /**
1072
+ * Channel where this message was sent. Resolved from cache; null if not cached.
1073
+ * Messages can only exist in text-based channels (text, DM, announcement), so this always has send() when non-null.
1074
+ */
1075
+ get channel(): (TextChannel | DMChannel | GuildChannel) | null;
1076
+ /** Guild where this message was sent. Resolved from cache; null for DMs or if not cached. */
1077
+ get guild(): Guild | null;
1078
+ /**
1079
+ * Resolve the channel (from cache or API). Use when you need the channel and it may not be cached.
1080
+ * @returns The channel
1081
+ * @throws FluxerError with CHANNEL_NOT_FOUND if the channel does not exist
1082
+ */
1083
+ resolveChannel(): Promise<Channel>;
1084
+ /**
1085
+ * Resolve the guild (from cache or API). Returns null for DMs.
1086
+ * @returns The guild, or null if this is a DM or guild not found
1087
+ */
1088
+ resolveGuild(): Promise<Guild | null>;
1089
+ /** @param data - API message from POST/PATCH /channels/{id}/messages or gateway MESSAGE_CREATE */
1090
+ constructor(client: Client, data: APIMessage);
1091
+ /**
1092
+ * Send a message to this channel without replying. Use when you want a standalone message.
1093
+ * @param options - Text content or object with content, embeds, and/or files
1094
+ * @example
1095
+ * await message.send('Pong!');
1096
+ * await message.send({ embeds: [embed] }); // EmbedBuilder auto-converted
1097
+ * await message.send({ content: 'File', files: [{ name: 'data.txt', data }] });
1098
+ */
1099
+ send(options: string | MessageSendOptions): Promise<Message>;
1100
+ /**
1101
+ * Send a message to a specific channel. Use for logging, forwarding, or sending to another channel in the guild.
1102
+ * @param channelId - Snowflake of the target channel (e.g. log channel ID)
1103
+ * @param options - Text content or object with content and/or embeds
1104
+ * @example
1105
+ * await message.sendTo(logChannelId, 'User ' + message.author.username + ' said: ' + message.content);
1106
+ * await message.sendTo(announceChannelId, { embeds: [embed] });
1107
+ */
1108
+ sendTo(channelId: string, options: MessageSendOptions): Promise<Message>;
1109
+ /**
1110
+ * Reply to this message (shows as a reply in the client).
1111
+ * @param options - Text content or object with content, embeds, and/or reply options (ping, replyTo)
1112
+ * @example
1113
+ * await message.reply('Pong!');
1114
+ * await message.reply({ embeds: [embed] });
1115
+ * await message.reply('No ping!', { ping: false });
1116
+ * await message.reply({ content: 'Reply to other', replyTo: otherMessage });
1117
+ */
1118
+ reply(options: string | (MessageSendOptions & ReplyOptions), replyOptions?: ReplyOptions): Promise<Message>;
1119
+ /** Exposed for testing purposes, use Message.reply() or send() for normal use */
1120
+ static _createMessageBody(content: string | MessageSendOptions, referenced_message?: {
1121
+ channel_id: string;
1122
+ message_id: string;
1123
+ guild_id?: string;
1124
+ }, ping?: boolean): Promise<MessagePayload>;
1125
+ _send(payload: MessagePayload): Promise<Message>;
1126
+ /**
1127
+ * Edit this message. Only the author (or admins) can edit.
1128
+ * @param options - New content and/or embeds
1129
+ */
1130
+ edit(options: MessageEditOptions): Promise<Message>;
1131
+ /**
1132
+ * Create a reaction collector for this message.
1133
+ * Collects reactions matching the filter until time expires or max is reached.
1134
+ * @param options - Filter, time (ms), and max count
1135
+ * @example
1136
+ * const collector = message.createReactionCollector({ filter: (r, u) => u.id === userId, time: 10000 });
1137
+ * collector.on('collect', (reaction, user) => console.log(user.username, 'reacted with', reaction.emoji.name));
1138
+ * collector.on('end', (collected, reason) => { ... });
1139
+ */
1140
+ createReactionCollector(options?: ReactionCollectorOptions): ReactionCollector;
1141
+ /**
1142
+ * Re-fetch this message from the API to get the latest content, embeds, reactions, etc.
1143
+ * Use when you have a stale Message (e.g. from an old event or cache) and need fresh data.
1144
+ * @returns The updated message
1145
+ * @throws FluxerError with MESSAGE_NOT_FOUND if the message was deleted or does not exist
1146
+ * @example
1147
+ * const updated = await message.fetch();
1148
+ * console.log('Latest content:', updated.content);
1149
+ */
1150
+ fetch(): Promise<Message>;
1151
+ /** Delete this message. */
1152
+ delete(): Promise<void>;
1153
+ /**
1154
+ * Delete a specific attachment from this message.
1155
+ * DELETE /channels/{id}/messages/{id}/attachments/{attachmentId}.
1156
+ */
1157
+ deleteAttachment(attachmentId: string): Promise<void>;
1158
+ /** Pin this message to the channel. Requires Manage Messages permission. */
1159
+ pin(): Promise<void>;
1160
+ /** Unpin this message from the channel. Requires Manage Messages permission. */
1161
+ unpin(): Promise<void>;
1162
+ /**
1163
+ * Format emoji for reaction API: unicode string or "name:id" for custom.
1164
+ * For string resolution (e.g. :name:), use client.resolveEmoji; Message methods resolve automatically when guildId is available.
1165
+ */
1166
+ private static formatEmoji;
1167
+ private resolveEmojiForReaction;
1168
+ /**
1169
+ * Add a reaction to this message (as the bot).
1170
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
1171
+ */
1172
+ react(emoji: string | {
1173
+ name: string;
1174
+ id?: string;
1175
+ animated?: boolean;
1176
+ }): Promise<void>;
1177
+ /**
1178
+ * Remove the bot's reaction, or a specific user's reaction if userId is provided.
1179
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`
1180
+ * @param userId - If provided, removes that user's reaction (requires moderator permissions)
1181
+ */
1182
+ removeReaction(emoji: string | {
1183
+ name: string;
1184
+ id?: string;
1185
+ animated?: boolean;
1186
+ }, userId?: string): Promise<void>;
1187
+ /**
1188
+ * Remove all reactions from this message.
1189
+ * Requires moderator permissions.
1190
+ */
1191
+ removeAllReactions(): Promise<void>;
1192
+ /**
1193
+ * Remove all reactions of a specific emoji from this message.
1194
+ * @param emoji - Unicode emoji, custom `{ name, id }`, `:name:`, `name:id`, or `<:name:id>`. Requires moderator permissions.
1195
+ */
1196
+ removeReactionEmoji(emoji: string | {
1197
+ name: string;
1198
+ id?: string;
1199
+ animated?: boolean;
1200
+ }): Promise<void>;
1201
+ /**
1202
+ * Fetch users who reacted with the given emoji.
1203
+ * @param emoji - Unicode emoji or custom `{ name, id }`
1204
+ * @param options - limit (1–100), after (user ID for pagination)
1205
+ * @returns Array of User objects
1206
+ */
1207
+ fetchReactionUsers(emoji: string | {
1208
+ name: string;
1209
+ id?: string;
1210
+ animated?: boolean;
1211
+ }, options?: {
1212
+ limit?: number;
1213
+ after?: string;
1214
+ }): Promise<User[]>;
1215
+ }
1216
+
1217
+ /**
1218
+ * Manages messages for a channel. Access via channel.messages.
1219
+ * @example
1220
+ * const message = channel.messages.get(messageId); // from cache (if enabled)
1221
+ * const message = await channel.messages.fetch(messageId); // from API
1222
+ * if (message) await message.edit({ content: 'Updated!' });
1223
+ */
1224
+ declare class MessageManager {
1225
+ private readonly client;
1226
+ private readonly channelId;
1227
+ constructor(client: Client, channelId: string);
1228
+ /**
1229
+ * Get a message from cache. Returns undefined if not cached or caching is disabled.
1230
+ * Requires options.cache.messages > 0.
1231
+ * @param messageId - Snowflake of the message
1232
+ */
1233
+ get(messageId: string): Message | undefined;
1234
+ /**
1235
+ * Fetch a message by ID from this channel.
1236
+ * When message caching is enabled, the fetched message is added to the cache.
1237
+ * @param messageId - Snowflake of the message
1238
+ * @returns The message
1239
+ * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
1240
+ */
1241
+ fetch(messageId: string): Promise<Message>;
1242
+ }
1243
+
1244
+ interface MessageCollectorOptions {
1245
+ /** Filter function. Return true to collect the message. */
1246
+ filter?: (message: Message) => boolean;
1247
+ /** Max duration in ms. Collector stops when time expires. */
1248
+ time?: number;
1249
+ /** Max messages to collect. Collector stops when limit reached. */
1250
+ max?: number;
1251
+ }
1252
+ type MessageCollectorEndReason = 'time' | 'limit' | 'user';
1253
+ interface MessageCollectorEvents {
1254
+ collect: [message: Message];
1255
+ end: [collected: Collection<string, Message>, reason: MessageCollectorEndReason];
1256
+ }
1257
+ /**
1258
+ * Collects messages in a channel. Use channel.createMessageCollector().
1259
+ * @example
1260
+ * const collector = channel.createMessageCollector({ filter: m => m.author.id === userId, time: 10000 });
1261
+ * collector.on('collect', m => console.log(m.content));
1262
+ * collector.on('end', (collected, reason) => console.log(`Stopped: ${reason}`));
1263
+ */
1264
+ declare class MessageCollector extends EventEmitter {
1265
+ readonly client: Client;
1266
+ readonly channelId: string;
1267
+ readonly options: Required<MessageCollectorOptions>;
1268
+ readonly collected: Collection<string, Message>;
1269
+ private _timeout;
1270
+ private _ended;
1271
+ private _listener;
1272
+ constructor(client: Client, channelId: string, options?: MessageCollectorOptions);
1273
+ stop(reason?: MessageCollectorEndReason): void;
1274
+ on<K extends keyof MessageCollectorEvents>(event: K, listener: (...args: MessageCollectorEvents[K]) => void): this;
1275
+ emit<K extends keyof MessageCollectorEvents>(event: K, ...args: MessageCollectorEvents[K]): boolean;
1276
+ }
1277
+
1278
+ /** Base class for all channel types. */
1279
+ declare abstract class Channel extends Base {
1280
+ /** Whether this channel has a send method (TextChannel, DMChannel). */
1281
+ isTextBased(): this is TextChannel | DMChannel;
1282
+ /** Whether this channel is a DM or Group DM. */
1283
+ isDM(): this is DMChannel;
1284
+ /** Whether this channel is voice-based (VoiceChannel). */
1285
+ isVoice(): this is VoiceChannel;
1286
+ isLink(): this is LinkChannel;
1287
+ /** Create a DM channel from API data (type DM or GroupDM). */
1288
+ static createDM(client: Client, data: APIChannelPartial): DMChannel;
1289
+ readonly client: Client;
1290
+ readonly id: string;
1291
+ type: ChannelType;
1292
+ /** Channel name. Guild channels and Group DMs have names; 1:1 DMs are typically null. */
1293
+ name: string | null;
1294
+ /** Channel icon hash (Group DMs). Null if none. */
1295
+ icon: string | null;
1296
+ /** ISO timestamp when the last message was pinned. Null if never pinned. */
1297
+ lastPinTimestamp: string | null;
1298
+ /** @param data - API channel from GET /channels/{id} or GET /guilds/{id}/channels */
1299
+ constructor(client: Client, data: APIChannelPartial);
1300
+ /**
1301
+ * Create the appropriate channel subclass from API data.
1302
+ * @param client - The client instance
1303
+ * @param data - Channel data from the API
1304
+ */
1305
+ static from(client: Client, data: APIChannel | APIChannelPartial): GuildChannel | TextChannel | null;
1306
+ /**
1307
+ * Create a channel from API data, including DM and GroupDM.
1308
+ * Used by ChannelManager.fetch() for GET /channels/{id}.
1309
+ */
1310
+ static fromOrCreate(client: Client, data: APIChannel | APIChannelPartial): TextChannel | DMChannel | GuildChannel | null;
1311
+ /**
1312
+ * Bulk delete messages. Requires Manage Messages permission.
1313
+ * @param messageIds - Array of message IDs to delete (2–100)
1314
+ */
1315
+ bulkDeleteMessages(messageIds: string[]): Promise<void>;
1316
+ /**
1317
+ * Send a typing indicator to the channel. Lasts ~10 seconds.
1318
+ */
1319
+ sendTyping(): Promise<void>;
1320
+ /**
1321
+ * Whether the bot can send messages in this channel.
1322
+ * For DMs: always true (when the channel exists).
1323
+ * For guild channels: checks ViewChannel and SendMessages permissions via guild.members.me.
1324
+ */
1325
+ canSendMessage(): boolean;
1326
+ }
1327
+ declare class GuildChannel extends Channel {
1328
+ readonly guildId: string;
1329
+ name: string | null;
1330
+ position?: number;
1331
+ parentId: string | null;
1332
+ /** Permission overwrites for roles and members. */
1333
+ permissionOverwrites: APIChannelOverwrite[];
1334
+ constructor(client: Client, data: APIChannel);
1335
+ /**
1336
+ * Create a webhook in this channel.
1337
+ * @param options - Webhook name and optional avatar URL
1338
+ * @returns The webhook with token (required for send()). Requires Manage Webhooks permission.
1339
+ */
1340
+ createWebhook(options: {
1341
+ name: string;
1342
+ avatar?: string | null;
1343
+ }): Promise<Webhook>;
1344
+ /**
1345
+ * Fetch all webhooks in this channel.
1346
+ * @returns Webhooks (includes token when listing from channel; can send via send())
1347
+ */
1348
+ fetchWebhooks(): Promise<Webhook[]>;
1349
+ /**
1350
+ * Create an invite for this channel.
1351
+ * @param options - max_uses (0–100), max_age (0–604800 seconds), unique, temporary
1352
+ * Requires Create Instant Invite permission.
1353
+ */
1354
+ createInvite(options?: {
1355
+ max_uses?: number;
1356
+ max_age?: number;
1357
+ unique?: boolean;
1358
+ temporary?: boolean;
1359
+ }): Promise<Invite>;
1360
+ /**
1361
+ * Fetch invites for this channel.
1362
+ * Requires Manage Channel permission.
1363
+ */
1364
+ fetchInvites(): Promise<Invite[]>;
1365
+ /**
1366
+ * Set or update a permission overwrite. PUT /channels/{id}/permissions/{overwriteId}.
1367
+ * @param overwriteId - Role or member ID
1368
+ * @param options - type (0=role, 1=member), allow, deny (permission bitfields)
1369
+ */
1370
+ editPermission(overwriteId: string, options: {
1371
+ type: 0 | 1;
1372
+ allow?: string;
1373
+ deny?: string;
1374
+ }): Promise<void>;
1375
+ /**
1376
+ * Whether the bot can send messages in this channel.
1377
+ * Checks ViewChannel and SendMessages via guild.members.me permissions.
1378
+ * Returns false if guild or bot member not cached.
1379
+ */
1380
+ canSendMessage(): boolean;
1381
+ /**
1382
+ * Send a message to this guild channel.
1383
+ * Works for text and announcement channels. Voice/category/link channels will fail at the API.
1384
+ */
1385
+ send(options: MessageSendOptions): Promise<Message>;
1386
+ /**
1387
+ * Remove a permission overwrite. DELETE /channels/{id}/permissions/{overwriteId}.
1388
+ */
1389
+ deletePermission(overwriteId: string): Promise<void>;
1390
+ /**
1391
+ * Edit this channel. PATCH /channels/{id}.
1392
+ * Requires Manage Channel permission.
1393
+ */
1394
+ edit(options: {
1395
+ name?: string | null;
1396
+ topic?: string | null;
1397
+ parent_id?: string | null;
1398
+ bitrate?: number | null;
1399
+ user_limit?: number | null;
1400
+ nsfw?: boolean;
1401
+ rate_limit_per_user?: number;
1402
+ rtc_region?: string | null;
1403
+ permission_overwrites?: Array<{
1404
+ id: string;
1405
+ type: number;
1406
+ allow?: string;
1407
+ deny?: string;
1408
+ }>;
1409
+ }): Promise<this>;
1410
+ /**
1411
+ * Delete this channel. Requires Manage Channel permission.
1412
+ * @param options - silent: if true, does not send a system message (default false)
1413
+ */
1414
+ delete(options?: {
1415
+ silent?: boolean;
1416
+ }): Promise<void>;
1417
+ }
1418
+ declare class TextChannel extends GuildChannel {
1419
+ topic?: string | null;
1420
+ nsfw?: boolean;
1421
+ rateLimitPerUser?: number;
1422
+ lastMessageId?: string | null;
1423
+ constructor(client: Client, data: APIChannel);
1424
+ /**
1425
+ * Send a message to this channel.
1426
+ * @param options - Text content or object with content, embeds, and/or files
1427
+ */
1428
+ send(options: MessageSendOptions): Promise<Message>;
1429
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
1430
+ get messages(): MessageManager;
1431
+ /**
1432
+ * Create a message collector for this channel.
1433
+ * Collects messages matching the filter until time expires or max is reached.
1434
+ * @param options - Filter, time (ms), and max count
1435
+ * @example
1436
+ * const collector = channel.createMessageCollector({ filter: m => m.author.id === userId, time: 10000 });
1437
+ * collector.on('collect', m => console.log(m.content));
1438
+ * collector.on('end', (collected, reason) => { ... });
1439
+ */
1440
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
1441
+ /**
1442
+ * Fetch pinned messages in this channel.
1443
+ * @returns Pinned messages
1444
+ */
1445
+ fetchPinnedMessages(): Promise<Message[]>;
1446
+ /**
1447
+ * Fetch a message by ID from this channel.
1448
+ * @param messageId - Snowflake of the message
1449
+ * @returns The message, or null if not found
1450
+ * @deprecated Use channel.messages.fetch(messageId) instead.
1451
+ */
1452
+ fetchMessage(messageId: string): Promise<Message>;
1453
+ }
1454
+ declare class CategoryChannel extends GuildChannel {
1455
+ }
1456
+ declare class VoiceChannel extends GuildChannel {
1457
+ bitrate?: number | null;
1458
+ userLimit?: number | null;
1459
+ rtcRegion?: string | null;
1460
+ constructor(client: Client, data: APIChannel);
1461
+ }
1462
+ declare class LinkChannel extends GuildChannel {
1463
+ url: string | null;
1464
+ constructor(client: Client, data: APIChannel);
1465
+ }
1466
+ /** DM channel (direct message between bot and a user). */
1467
+ declare class DMChannel extends Channel {
1468
+ lastMessageId?: string | null;
1469
+ /** Group DM creator ID. Null for 1:1 DMs. */
1470
+ ownerId: string | null;
1471
+ /** Group DM recipients as User objects. Empty for 1:1 DMs. */
1472
+ recipients: User[];
1473
+ /** Group DM member display names (userId -> nickname). */
1474
+ nicks: Record<string, string>;
1475
+ constructor(client: Client, data: APIChannelPartial & Partial<APIChannel>);
1476
+ /**
1477
+ * Send a message to this DM channel.
1478
+ * @param options - Text content or object with content, embeds, and/or files
1479
+ */
1480
+ send(options: MessageSendOptions): Promise<Message>;
1481
+ /** Message manager for this channel. Use channel.messages.fetch(messageId). */
1482
+ get messages(): MessageManager;
1483
+ /**
1484
+ * Create a message collector for this DM channel.
1485
+ * @param options - Filter, time (ms), and max count
1486
+ */
1487
+ createMessageCollector(options?: MessageCollectorOptions): MessageCollector;
1488
+ /**
1489
+ * Fetch pinned messages in this DM channel.
1490
+ * @returns Pinned messages
1491
+ */
1492
+ fetchPinnedMessages(): Promise<Message[]>;
1493
+ /**
1494
+ * Fetch a message by ID from this DM channel.
1495
+ * @param messageId - Snowflake of the message
1496
+ * @returns The message, or null if not found
1497
+ * @deprecated Use channel.messages.fetch(messageId) instead.
1498
+ */
1499
+ fetchMessage(messageId: string): Promise<Message>;
1500
+ /**
1501
+ * Add a recipient to this Group DM. Requires Group DM (type GroupDM).
1502
+ * PUT /channels/{id}/recipients/{userId}.
1503
+ */
1504
+ addRecipient(userId: string): Promise<void>;
1505
+ /**
1506
+ * Remove a recipient from this Group DM. Requires Group DM (type GroupDM).
1507
+ * DELETE /channels/{id}/recipients/{userId}.
1508
+ * @param options - silent: if true, does not send a system message (default false)
1509
+ */
1510
+ removeRecipient(userId: string, options?: {
1511
+ silent?: boolean;
1512
+ }): Promise<void>;
1513
+ }
1514
+
1515
+ /**
1516
+ * Manages channels with fetch and send.
1517
+ * Extends Collection so you can use .get(), .set(), .filter(), etc.
1518
+ */
1519
+ declare class ChannelManager extends Collection<string, Channel | GuildChannel> {
1520
+ private readonly client;
1521
+ private readonly maxSize;
1522
+ constructor(client: Client);
1523
+ set(key: string, value: Channel): this;
1524
+ /**
1525
+ * Get a channel from cache or fetch from the API if not present.
1526
+ * Convenience helper to avoid repeating `client.channels.get(id) ?? (await client.channels.fetch(id))`.
1527
+ * @param channelId - Snowflake of the channel
1528
+ * @returns The channel
1529
+ * @throws FluxerError with CHANNEL_NOT_FOUND if the channel does not exist
1530
+ * @example
1531
+ * const channel = await client.channels.resolve(message.channelId);
1532
+ * if (channel?.isTextBased()) await channel.send('Hello!');
1533
+ */
1534
+ resolve(channelId: string): Promise<Channel>;
1535
+ /**
1536
+ * Fetch a channel by ID from the API (or return from cache if present).
1537
+ * @param channelId - Snowflake of the channel
1538
+ * @returns The channel
1539
+ * @throws FluxerError with CHANNEL_NOT_FOUND if the channel does not exist
1540
+ * @example
1541
+ * const channel = await client.channels.fetch(channelId);
1542
+ * if (channel?.isTextBased()) await channel.send('Hello!');
1543
+ */
1544
+ fetch(channelId: string): Promise<Channel>;
1545
+ /**
1546
+ * Fetch a message by ID from the API.
1547
+ * @param channelId - Snowflake of the channel
1548
+ * @param messageId - Snowflake of the message
1549
+ * @returns The message
1550
+ * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
1551
+ * @deprecated Use channel.messages.fetch(messageId). Prefer (await client.channels.resolve(channelId))?.messages?.fetch(messageId).
1552
+ * @example
1553
+ * const channel = await client.channels.resolve(channelId);
1554
+ * const message = await channel?.messages?.fetch(messageId);
1555
+ */
1556
+ fetchMessage(channelId: string, messageId: string): Promise<Message>;
1557
+ /**
1558
+ * Send a message to a channel by ID. Works even when the channel is not cached.
1559
+ * Skips the fetch when you only need to send.
1560
+ * @param channelId - Snowflake of the channel (text channel or DM)
1561
+ * @param payload - Text content or object with content, embeds, and/or files
1562
+ * @returns The created message
1563
+ * @example
1564
+ * await client.channels.send(logChannelId, 'User joined!');
1565
+ * await client.channels.send(channelId, { embeds: [embed] });
1566
+ * await client.channels.send(channelId, { content: 'Report', files: [{ name: 'log.txt', data }] });
1567
+ */
1568
+ send(channelId: string, payload: string | MessageSendOptions): Promise<Message>;
1569
+ }
1570
+
1571
+ /**
1572
+ * Manages guilds with fetch.
1573
+ * Extends Collection so you can use .get(), .set(), .filter(), etc.
1574
+ */
1575
+ declare class GuildManager extends Collection<string, Guild> {
1576
+ private readonly client;
1577
+ private readonly maxSize;
1578
+ constructor(client: Client);
1579
+ set(key: string, value: Guild): this;
1580
+ /**
1581
+ * Get a guild from cache or fetch from the API if not present.
1582
+ * Convenience helper to avoid repeating `client.guilds.get(id) ?? (await client.guilds.fetch(id))`.
1583
+ * @param guildId - Snowflake of the guild
1584
+ * @returns The guild, or null if not found
1585
+ * @example
1586
+ * const guild = await client.guilds.resolve(message.guildId);
1587
+ * if (guild) console.log(guild.name);
1588
+ */
1589
+ resolve(guildId: string): Promise<Guild | null>;
1590
+ /**
1591
+ * Create a guild. POST /guilds.
1592
+ * @param options - name (required), icon (base64), empty_features
1593
+ * @returns The created guild
1594
+ */
1595
+ create(options: {
1596
+ name: string;
1597
+ icon?: string | null;
1598
+ empty_features?: boolean;
1599
+ }): Promise<Guild>;
1600
+ /**
1601
+ * Fetch a guild by ID from the API (or return from cache if present).
1602
+ * @param guildId - Snowflake of the guild
1603
+ * @returns The guild, or null if not found
1604
+ * @example
1605
+ * const guild = await client.guilds.fetch(guildId);
1606
+ * if (guild) console.log(guild.name);
1607
+ */
1608
+ fetch(guildId: string): Promise<Guild | null>;
1609
+ }
1610
+
1611
+ /** Optional cache size limits. When exceeded, oldest entries are evicted (FIFO). Omit or use 0 for unbounded. */
1612
+ interface CacheSizeLimits {
1613
+ channels?: number;
1614
+ guilds?: number;
1615
+ users?: number;
1616
+ /** Max messages per channel to cache. Enables channel.messages.get() and oldMessage in messageUpdate. 0 = disabled. */
1617
+ messages?: number;
1618
+ }
1619
+ interface ClientOptions {
1620
+ rest?: Partial<ConstructorParameters<typeof REST>[0]>;
1621
+ /** Gateway intents. Not yet supported by Fluxer—value is always sent as 0. Set suppressIntentWarning to silence the warning. */
1622
+ intents?: number;
1623
+ /** Suppress the warning when intents are set (Fluxer does not support intents yet). */
1624
+ suppressIntentWarning?: boolean;
1625
+ /** When true, delay the Ready event until all guilds from READY (including unavailable) have been received via GUILD_CREATE. Default: false. */
1626
+ waitForGuilds?: boolean;
1627
+ /** Cache size limits (channels, guilds, users). When exceeded, oldest entries are evicted. Omit or 0 = unbounded. */
1628
+ cache?: CacheSizeLimits;
1629
+ /** Initial presence (status, custom_status, etc.) sent on identify. Can also update via PresenceUpdate after connect. */
1630
+ presence?: GatewayPresenceUpdateData;
1631
+ /** Optional WebSocket constructor (e.g. `require('ws')` in Node for compatibility) */
1632
+ WebSocket?: new (url: string) => {
1633
+ send(data: string | ArrayBufferLike): void;
1634
+ close(code?: number): void;
1635
+ readyState: number;
1636
+ addEventListener?(type: string, listener: (e: unknown) => void): void;
1637
+ on?(event: string, cb: (data?: unknown) => void): void;
1638
+ };
1639
+ }
1640
+
1641
+ declare class ClientUser extends User {
1642
+ readonly client: Client;
1643
+ constructor(client: Client, data: APIUserPartial);
1644
+ /**
1645
+ * Fetch guilds the bot is a member of.
1646
+ * @returns Array of Guild objects (cached in client.guilds)
1647
+ */
1648
+ fetchGuilds(): Promise<Guild[]>;
1649
+ /**
1650
+ * Leave a guild. Requires the bot to be a member.
1651
+ * @param guildId - The guild ID to leave
1652
+ */
1653
+ leaveGuild(guildId: string): Promise<void>;
1654
+ }
1655
+
1656
+ /** Event name constants for client.on(Events.X, handler). Use with ClientEvents for typed callbacks. */
1657
+ declare const Events: {
1658
+ readonly Ready: "ready";
1659
+ readonly MessageCreate: "messageCreate";
1660
+ readonly MessageUpdate: "messageUpdate";
1661
+ readonly MessageDelete: "messageDelete";
1662
+ readonly MessageDeleteBulk: "messageDeleteBulk";
1663
+ readonly MessageReactionAdd: "messageReactionAdd";
1664
+ readonly MessageReactionRemove: "messageReactionRemove";
1665
+ readonly MessageReactionRemoveAll: "messageReactionRemoveAll";
1666
+ readonly MessageReactionRemoveEmoji: "messageReactionRemoveEmoji";
1667
+ readonly InteractionCreate: "interactionCreate";
1668
+ readonly GuildCreate: "guildCreate";
1669
+ readonly GuildUpdate: "guildUpdate";
1670
+ readonly GuildDelete: "guildDelete";
1671
+ readonly GuildBanAdd: "guildBanAdd";
1672
+ readonly GuildBanRemove: "guildBanRemove";
1673
+ readonly GuildEmojisUpdate: "guildEmojisUpdate";
1674
+ readonly GuildStickersUpdate: "guildStickersUpdate";
1675
+ readonly GuildIntegrationsUpdate: "guildIntegrationsUpdate";
1676
+ readonly GuildMemberAdd: "guildMemberAdd";
1677
+ readonly GuildMemberUpdate: "guildMemberUpdate";
1678
+ readonly GuildMemberRemove: "guildMemberRemove";
1679
+ readonly GuildMembersChunk: "guildMembersChunk";
1680
+ readonly GuildRoleCreate: "guildRoleCreate";
1681
+ readonly GuildRoleUpdate: "guildRoleUpdate";
1682
+ readonly GuildRoleDelete: "guildRoleDelete";
1683
+ readonly GuildScheduledEventCreate: "guildScheduledEventCreate";
1684
+ readonly GuildScheduledEventUpdate: "guildScheduledEventUpdate";
1685
+ readonly GuildScheduledEventDelete: "guildScheduledEventDelete";
1686
+ readonly ChannelCreate: "channelCreate";
1687
+ readonly ChannelUpdate: "channelUpdate";
1688
+ readonly ChannelDelete: "channelDelete";
1689
+ readonly ChannelPinsUpdate: "channelPinsUpdate";
1690
+ readonly InviteCreate: "inviteCreate";
1691
+ readonly InviteDelete: "inviteDelete";
1692
+ readonly TypingStart: "typingStart";
1693
+ readonly UserUpdate: "userUpdate";
1694
+ readonly PresenceUpdate: "presenceUpdate";
1695
+ readonly VoiceStateUpdate: "voiceStateUpdate";
1696
+ readonly VoiceServerUpdate: "voiceServerUpdate";
1697
+ readonly VoiceStatesSync: "voiceStatesSync";
1698
+ readonly WebhooksUpdate: "webhooksUpdate";
1699
+ readonly Resumed: "resumed";
1700
+ readonly Error: "error";
1701
+ readonly Debug: "debug";
1702
+ };
1703
+
1704
+ /** Result of {@link UsersManager.fetchWithProfile}. */
1705
+ interface FetchedUserWithProfile {
1706
+ /** The user (cached in client.users). */
1707
+ user: User;
1708
+ /** Raw user data from GET /users/{id}. */
1709
+ userData: APIUserPartial;
1710
+ /** Global profile (bio, pronouns, mutual guilds, etc.). Null if unavailable. */
1711
+ globalProfile: APIProfileResponse | null;
1712
+ /** Server-specific profile when guildId was provided. Null if unavailable. */
1713
+ serverProfile: APIProfileResponse | null;
1714
+ /** Guild member when guildId was provided and user is in the guild. Null otherwise. */
1715
+ member: GuildMember | null;
1716
+ /** Raw member data when member exists (for premium_since, etc.). */
1717
+ memberData: (APIGuildMember & {
1718
+ user: {
1719
+ id: string;
1720
+ };
1721
+ }) | null;
1722
+ }
1723
+ /**
1724
+ * Manages users with fetch and profile helpers.
1725
+ * Extends Collection so you can use .get(), .set(), .filter(), etc.
1726
+ */
1727
+ declare class UsersManager extends Collection<string, User> {
1728
+ private readonly client;
1729
+ private readonly maxSize;
1730
+ constructor(client: Client);
1731
+ set(key: string, value: User): this;
1732
+ /**
1733
+ * Fetch a user by ID from the API.
1734
+ * Updates cache if user already exists.
1735
+ * @param userId - Snowflake of the user
1736
+ * @returns The user
1737
+ * @throws FluxerError (or REST error) if user not found
1738
+ * @example
1739
+ * const user = await client.users.fetch(userId);
1740
+ * console.log(user.username);
1741
+ */
1742
+ fetch(userId: string): Promise<User>;
1743
+ /**
1744
+ * Fetch a user with full profile and optional guild context.
1745
+ * Returns user, global profile, server profile (when guildId), and member (when guildId).
1746
+ * Ideal for userinfo commands.
1747
+ * @param userId - Snowflake of the user
1748
+ * @param options - Optional guildId for server profile and member data
1749
+ * @returns User, raw data, profiles, and member (when in guild)
1750
+ * @throws FluxerError (or REST error) if user not found
1751
+ * @example
1752
+ * const { user, globalProfile, serverProfile, member } = await client.users.fetchWithProfile(
1753
+ * userId,
1754
+ * { guildId: message.guildId ?? undefined },
1755
+ * );
1756
+ */
1757
+ fetchWithProfile(userId: string, options?: {
1758
+ guildId?: string | null;
1759
+ }): Promise<FetchedUserWithProfile>;
1760
+ }
1761
+
1762
+ /** Minimal message data for MessageDelete when the full message is not available. */
1763
+ interface PartialMessage {
1764
+ id: string;
1765
+ channelId: string;
1766
+ channel?: Channel | null;
1767
+ /** Message content, when provided by the gateway (e.g. Fluxer). */
1768
+ content?: string | null;
1769
+ /** Author user ID, when provided by the gateway (e.g. Fluxer). */
1770
+ authorId?: string | null;
1771
+ }
1772
+
1773
+ /**
1774
+ * Callback parameter types for client events. Use with client.on(Events.X, handler).
1775
+ * @see Events
1776
+ */
1777
+ interface ClientEvents {
1778
+ [Events.Ready]: [];
1779
+ [Events.MessageCreate]: [message: Message];
1780
+ [Events.MessageUpdate]: [oldMessage: Message | null, newMessage: Message];
1781
+ [Events.MessageDelete]: [message: PartialMessage];
1782
+ [Events.MessageReactionAdd]: [
1783
+ reaction: MessageReaction,
1784
+ user: User,
1785
+ messageId: string,
1786
+ channelId: string,
1787
+ emoji: GatewayReactionEmoji,
1788
+ userId: string
1789
+ ];
1790
+ [Events.MessageReactionRemove]: [
1791
+ reaction: MessageReaction,
1792
+ user: User,
1793
+ messageId: string,
1794
+ channelId: string,
1795
+ emoji: GatewayReactionEmoji,
1796
+ userId: string
1797
+ ];
1798
+ [Events.MessageReactionRemoveAll]: [data: GatewayMessageReactionRemoveAllDispatchData];
1799
+ [Events.MessageReactionRemoveEmoji]: [data: GatewayMessageReactionRemoveEmojiDispatchData];
1800
+ [Events.InteractionCreate]: [interaction: APIApplicationCommandInteraction];
1801
+ [Events.GuildCreate]: [guild: Guild];
1802
+ [Events.GuildUpdate]: [oldGuild: Guild, newGuild: Guild];
1803
+ [Events.GuildDelete]: [guild: Guild];
1804
+ [Events.ChannelCreate]: [channel: GuildChannel];
1805
+ [Events.ChannelUpdate]: [oldChannel: Channel, newChannel: Channel];
1806
+ [Events.ChannelDelete]: [channel: Channel];
1807
+ [Events.GuildMemberAdd]: [member: GuildMember];
1808
+ [Events.GuildMemberUpdate]: [oldMember: GuildMember, newMember: GuildMember];
1809
+ [Events.GuildMemberRemove]: [member: GuildMember];
1810
+ [Events.GuildMembersChunk]: [data: GatewayGuildMembersChunkDispatchData];
1811
+ [Events.VoiceStateUpdate]: [data: GatewayVoiceStateUpdateDispatchData];
1812
+ [Events.VoiceServerUpdate]: [data: GatewayVoiceServerUpdateDispatchData];
1813
+ [Events.VoiceStatesSync]: [
1814
+ data: {
1815
+ guildId: string;
1816
+ voiceStates: Array<{
1817
+ user_id: string;
1818
+ channel_id: string | null;
1819
+ }>;
1820
+ }
1821
+ ];
1822
+ [Events.MessageDeleteBulk]: [data: GatewayMessageDeleteBulkDispatchData];
1823
+ [Events.GuildBanAdd]: [ban: GuildBan];
1824
+ [Events.GuildBanRemove]: [ban: GuildBan];
1825
+ [Events.GuildEmojisUpdate]: [data: GatewayGuildEmojisUpdateDispatchData];
1826
+ [Events.GuildStickersUpdate]: [data: GatewayGuildStickersUpdateDispatchData];
1827
+ [Events.GuildIntegrationsUpdate]: [data: GatewayGuildIntegrationsUpdateDispatchData];
1828
+ [Events.GuildRoleCreate]: [data: GatewayGuildRoleCreateDispatchData];
1829
+ [Events.GuildRoleUpdate]: [data: GatewayGuildRoleUpdateDispatchData];
1830
+ [Events.GuildRoleDelete]: [data: GatewayGuildRoleDeleteDispatchData];
1831
+ [Events.GuildScheduledEventCreate]: [data: GatewayGuildScheduledEventCreateDispatchData];
1832
+ [Events.GuildScheduledEventUpdate]: [data: GatewayGuildScheduledEventUpdateDispatchData];
1833
+ [Events.GuildScheduledEventDelete]: [data: GatewayGuildScheduledEventDeleteDispatchData];
1834
+ [Events.ChannelPinsUpdate]: [data: GatewayChannelPinsUpdateDispatchData];
1835
+ [Events.InviteCreate]: [invite: Invite];
1836
+ [Events.InviteDelete]: [data: GatewayInviteDeleteDispatchData];
1837
+ [Events.TypingStart]: [data: GatewayTypingStartDispatchData];
1838
+ [Events.UserUpdate]: [data: GatewayUserUpdateDispatchData];
1839
+ [Events.PresenceUpdate]: [data: GatewayPresenceUpdateDispatchData];
1840
+ [Events.WebhooksUpdate]: [data: GatewayWebhooksUpdateDispatchData];
1841
+ [Events.Resumed]: [];
1842
+ [Events.Error]: [error: Error];
1843
+ [Events.Debug]: [message: string];
1844
+ }
1845
+ type ClientEventName = keyof ClientEvents;
1846
+ type ClientEventListener<K extends ClientEventName> = (...args: ClientEvents[K]) => void;
1847
+ /** Typed event handler methods. Use client.events.MessageReactionAdd((reaction, user, messageId, channelId, emoji, userId) => {...}) or client.on(Events.MessageReactionAdd, ...). */
1848
+ type ClientEventMethods = {
1849
+ [K in keyof typeof Events]: (cb: (...args: ClientEvents[(typeof Events)[K]]) => void) => Client;
1850
+ };
1851
+ /** Main Fluxer bot client. Connects to the gateway, emits events, and provides REST access. */
1852
+ declare class Client extends EventEmitter {
1853
+ readonly options: ClientOptions;
1854
+ readonly rest: REST;
1855
+ readonly guilds: GuildManager;
1856
+ readonly channels: ChannelManager;
1857
+ readonly users: UsersManager;
1858
+ /** Typed event handlers. Use client.events.MessageReactionAdd((reaction, user, messageId, channelId, emoji, userId) => {...}) or client.on(Events.MessageReactionAdd, ...). */
1859
+ readonly events: ClientEventMethods;
1860
+ /** The authenticated bot user. Null until READY is received. */
1861
+ user: ClientUser | null;
1862
+ /** Timestamp when the client became ready. Null until READY is received. */
1863
+ readyAt: Date | null;
1864
+ private _ws;
1865
+ /** When waitForGuilds, set of guild IDs we're waiting for GUILD_CREATE on. Null when not waiting. */
1866
+ _pendingGuildIds: Set<string> | null;
1867
+ /** Timeout for guild stream when READY has no guilds (gateway sends only GUILD_CREATE). Cleared in finally. */
1868
+ private _guildStreamSettleTimeout;
1869
+ /** Per-channel message cache (channelId -> messageId -> APIMessage). Used when options.cache.messages > 0. */
1870
+ private _messageCaches;
1871
+ /** @param options - Token, REST config, WebSocket, presence, etc. */
1872
+ constructor(options?: ClientOptions);
1873
+ /** Typed EventEmitter.on for known client events. */
1874
+ on<K extends ClientEventName>(event: K, listener: ClientEventListener<K>): this;
1875
+ on(event: string | symbol, listener: (...args: unknown[]) => void): this;
1876
+ /** Typed EventEmitter.once for known client events. */
1877
+ once<K extends ClientEventName>(event: K, listener: ClientEventListener<K>): this;
1878
+ once(event: string | symbol, listener: (...args: unknown[]) => void): this;
1879
+ /** Typed EventEmitter.off for known client events. */
1880
+ off<K extends ClientEventName>(event: K, listener: ClientEventListener<K>): this;
1881
+ off(event: string | symbol, listener: (...args: unknown[]) => void): this;
1882
+ /** Typed EventEmitter.emit for known client events. */
1883
+ emit<K extends ClientEventName>(event: K, ...args: ClientEvents[K]): boolean;
1884
+ emit(event: string | symbol, ...args: unknown[]): boolean;
1885
+ /**
1886
+ * Resolve an emoji argument to the API format (unicode or "name:id").
1887
+ * Supports: <:name:id>, :name:, name:id, { name, id }, unicode.
1888
+ * When id is missing (e.g. :name:), fetches guild emojis if guildId provided.
1889
+ * When reacting in a guild channel, custom emojis must be from that guild.
1890
+ * @param emoji - Emoji string or object
1891
+ * @param guildId - Guild ID for resolving custom emoji by name (required when id is missing)
1892
+ * @returns API-formatted string for reactions
1893
+ */
1894
+ resolveEmoji(emoji: string | {
1895
+ name: string;
1896
+ id?: string;
1897
+ animated?: boolean;
1898
+ }, guildId?: string | null): Promise<string>;
1899
+ /**
1900
+ * Asserts that a custom emoji (by id) belongs to the given guild.
1901
+ * Used when reacting in guild channels to reject emojis from other servers.
1902
+ * @throws FluxerError with EMOJI_NOT_IN_GUILD if the emoji is not in the guild
1903
+ */
1904
+ private assertEmojiInGuild;
1905
+ /**
1906
+ * Fetch instance discovery info (API URL, gateway URL, features).
1907
+ * Uses canonical GET /.well-known/fluxer.
1908
+ * Does not require authentication.
1909
+ */
1910
+ fetchInstance(): Promise<APIInstance>;
1911
+ /**
1912
+ * Fetch gateway connection metadata (WebSocket URL, recommended shards, session limits).
1913
+ * Uses authenticated GET /gateway/bot.
1914
+ */
1915
+ fetchGatewayInfo(): Promise<APIGatewayBotResponse>;
1916
+ /**
1917
+ * Fetch a message by channel and message ID. Use when you have IDs (e.g. from a DB).
1918
+ * @param channelId - Snowflake of the channel
1919
+ * @param messageId - Snowflake of the message
1920
+ * @returns The message
1921
+ * @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
1922
+ * @deprecated Use channel.messages.fetch(messageId). For IDs-only: (await client.channels.resolve(channelId))?.messages?.fetch(messageId)
1923
+ * @example
1924
+ * const channel = await client.channels.resolve(channelId);
1925
+ * const message = await channel?.messages?.fetch(messageId);
1926
+ */
1927
+ fetchMessage(channelId: string, messageId: string): Promise<Message>;
1928
+ /**
1929
+ * Send a message to any channel by ID. Shorthand for client.channels.send().
1930
+ * Works even when the channel is not cached.
1931
+ * @deprecated Use client.channels.send(channelId, payload).
1932
+ */
1933
+ sendToChannel(channelId: string, payload: string | MessageSendOptions): Promise<Message>;
1934
+ /**
1935
+ * Get the message cache for a channel. Returns null if message caching is disabled.
1936
+ * Used by MessageManager.get() and event handlers.
1937
+ * @internal
1938
+ */
1939
+ _getMessageCache(channelId: string): Map<string, APIMessage> | null;
1940
+ /**
1941
+ * Add a message to the channel cache. Evicts oldest (FIFO) when over limit.
1942
+ * @internal
1943
+ */
1944
+ _addMessageToCache(channelId: string, data: APIMessage): void;
1945
+ /**
1946
+ * Remove a message from the channel cache.
1947
+ * @internal
1948
+ */
1949
+ _removeMessageFromCache(channelId: string, messageId: string): void;
1950
+ /**
1951
+ * Get or create a User from API data. Caches in client.users.
1952
+ * Updates existing user's username, avatar, etc. when fresh data is provided.
1953
+ */
1954
+ getOrCreateUser(data: APIUserPartial): User;
1955
+ /** WebSocket manager. Throws if not logged in. */
1956
+ get ws(): WebSocketManager;
1957
+ /**
1958
+ * Send a payload to the gateway (e.g. Voice State Update).
1959
+ * @param shardId - Shard ID (use 0 for single-shard)
1960
+ * @param payload - Gateway payload to send
1961
+ */
1962
+ sendToGateway(shardId: number, payload: GatewaySendPayload): void;
1963
+ private handleDispatch;
1964
+ /**
1965
+ * Connect to the Fluxer gateway and authenticate.
1966
+ * @param token - Bot token (e.g. from FLUXER_BOT_TOKEN)
1967
+ */
1968
+ login(token: string): Promise<string>;
1969
+ /**
1970
+ * Called when all guilds have been received (or immediately if not waiting).
1971
+ * Sets readyAt, emits Ready, clears pending state.
1972
+ */
1973
+ _finalizeReady(): void;
1974
+ /**
1975
+ * Called by GUILD_CREATE handler when waitForGuilds is enabled.
1976
+ * Removes guild from pending set; when empty, finalizes ready.
1977
+ */
1978
+ _onGuildReceived(guildId: string): void;
1979
+ /** Disconnect from the gateway and clear cached data. */
1980
+ destroy(): Promise<void>;
1981
+ /** Returns true if the client has received Ready and `user` is set. */
1982
+ isReady(): this is Client & {
1983
+ user: NonNullable<Client['user']>;
1984
+ };
1985
+ /**
1986
+ * Throws if the client is not ready. Use before accessing client.user or other post-ready state.
1987
+ * @throws FluxerError with CLIENT_NOT_READY if client has not received Ready yet
1988
+ */
1989
+ assertReady(): asserts this is Client & {
1990
+ user: NonNullable<Client['user']>;
1991
+ };
1992
+ static get Routes(): typeof Routes;
1993
+ }
1994
+
1995
+ interface FluxerErrorOptions {
1996
+ code?: string;
1997
+ cause?: Error;
1998
+ }
1999
+ declare class FluxerError extends Error {
2000
+ readonly code?: string;
2001
+ constructor(message: string, options?: FluxerErrorOptions);
2002
+ }
2003
+
2004
+ declare const ErrorCodes: {
2005
+ readonly ClientNotReady: "CLIENT_NOT_READY";
2006
+ readonly InvalidToken: "INVALID_TOKEN";
2007
+ readonly AlreadyLoggedIn: "ALREADY_LOGGED_IN";
2008
+ readonly ChannelNotFound: "CHANNEL_NOT_FOUND";
2009
+ readonly MessageNotFound: "MESSAGE_NOT_FOUND";
2010
+ readonly GuildNotFound: "GUILD_NOT_FOUND";
2011
+ readonly MemberNotFound: "MEMBER_NOT_FOUND";
2012
+ readonly RoleNotFound: "ROLE_NOT_FOUND";
2013
+ readonly EmojiNotInGuild: "EMOJI_NOT_IN_GUILD";
2014
+ readonly EmojiNotFound: "EMOJI_NOT_FOUND";
2015
+ };
2016
+
2017
+ /** User Content CDN (avatars, icons, banners, emojis, attachments). */
2018
+ declare const CDN_URL = "https://fluxerusercontent.com";
2019
+ /** Static Assets CDN (default avatars). Use fluxerstatic.com for default avatars per Fluxer API. */
2020
+ declare const STATIC_CDN_URL = "https://fluxerstatic.com";
2021
+
2022
+ interface CdnUrlOptions {
2023
+ size?: number;
2024
+ extension?: string;
2025
+ }
2026
+ /**
2027
+ * Build a user avatar URL from raw API data.
2028
+ * @param userId - The user's snowflake ID
2029
+ * @param avatarHash - The avatar hash from the API, or null if no custom avatar
2030
+ * @param options - Optional size and extension (default: png; auto-detects gif for a_ hashes)
2031
+ * @returns The avatar URL, or null if no avatar hash
2032
+ * @example
2033
+ * const url = cdnAvatarURL(userData.id, userData.avatar, { size: 256 });
2034
+ */
2035
+ declare function cdnAvatarURL(userId: string, avatarHash: string | null, options?: CdnUrlOptions): string | null;
2036
+ /**
2037
+ * Build an avatar URL, or the default avatar when none set.
2038
+ * @param userId - The user's snowflake ID
2039
+ * @param avatarHash - The avatar hash from the API, or null
2040
+ * @param options - Optional size and extension
2041
+ * @returns The avatar URL (never null)
2042
+ * @example
2043
+ * const url = cdnDisplayAvatarURL(user.id, user.avatar, { size: 64 });
2044
+ */
2045
+ declare function cdnDisplayAvatarURL(userId: string, avatarHash: string | null, options?: CdnUrlOptions): string;
2046
+ /**
2047
+ * Build a user or guild banner URL from raw API data.
2048
+ * @param resourceId - The user ID or guild ID
2049
+ * @param bannerHash - The banner hash from the API, or null
2050
+ * @param options - Optional size and extension (default: png; auto-detects gif for a_ hashes)
2051
+ * @returns The banner URL, or null if no banner
2052
+ * @example
2053
+ * const url = cdnBannerURL(userData.id, profile.banner, { size: 512 });
2054
+ */
2055
+ declare function cdnBannerURL(resourceId: string, bannerHash: string | null, options?: CdnUrlOptions): string | null;
2056
+ /**
2057
+ * Build a guild member avatar URL (guild-specific avatar).
2058
+ * @param guildId - The guild ID
2059
+ * @param userId - The user ID
2060
+ * @param avatarHash - The member avatar hash, or null
2061
+ * @param options - Optional size and extension
2062
+ * @returns The member avatar URL, or null if no guild avatar
2063
+ * @example
2064
+ * const url = cdnMemberAvatarURL(member.guild.id, member.id, member.avatar);
2065
+ */
2066
+ declare function cdnMemberAvatarURL(guildId: string, userId: string, avatarHash: string | null, options?: CdnUrlOptions): string | null;
2067
+ /**
2068
+ * Build a guild member banner URL (guild-specific banner).
2069
+ * @param guildId - The guild ID
2070
+ * @param userId - The user ID
2071
+ * @param bannerHash - The member banner hash, or null
2072
+ * @param options - Optional size and extension
2073
+ * @returns The member banner URL, or null if no guild banner
2074
+ */
2075
+ declare function cdnMemberBannerURL(guildId: string, userId: string, bannerHash: string | null, options?: CdnUrlOptions): string | null;
2076
+ /**
2077
+ * Get the default avatar URL (used when user has no custom avatar).
2078
+ * Fluxer uses fluxerstatic.com with index = userId % 6 (six default avatar variants).
2079
+ * @param userIdOrIndex - User ID (snowflake string) to derive index, or explicit index 0-5
2080
+ * @returns The default avatar URL
2081
+ */
2082
+ declare function cdnDefaultAvatarURL(userIdOrIndex: string | number): string;
2083
+
2084
+ export { Base, CDN_URL, CategoryChannel, type CdnUrlOptions, Channel, ChannelManager, Client, type ClientEventMethods, type ClientEvents, ClientUser, type CollectedReaction, DMChannel, ErrorCodes, Events, type FetchedUserWithProfile, FluxerError, type FluxerErrorOptions, Guild, GuildBan, GuildChannel, GuildEmoji, GuildMember, GuildMemberManager, GuildMemberRoleManager, GuildSticker, Invite, LinkChannel, Message, MessageCollector, type MessageCollectorEndReason, type MessageCollectorOptions, type MessageEditOptions, MessageManager, MessageReaction, type MessageSendOptions, type PartialMessage, ReactionCollector, type ReactionCollectorEndReason, type ReactionCollectorOptions, type ReplyOptions, Role, type RoleResolvable, STATIC_CDN_URL, TextChannel, User, UsersManager, VoiceChannel, Webhook, type WebhookSendOptions, cdnAvatarURL, cdnBannerURL, cdnDefaultAvatarURL, cdnDisplayAvatarURL, cdnMemberAvatarURL, cdnMemberBannerURL };