@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
@@ -1,110 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { Client, User } from '../';
3
-
4
- function createMockClient() {
5
- return {} as Client;
6
- }
7
-
8
- function createUser(
9
- overrides: Partial<{
10
- id: string;
11
- username: string;
12
- avatar: string | null;
13
- banner: string | null;
14
- }> = {},
15
- ) {
16
- return new User(createMockClient(), {
17
- id: overrides.id ?? '123456789012345678',
18
- username: overrides.username ?? 'TestUser',
19
- discriminator: '0',
20
- avatar: overrides.avatar ?? null,
21
- banner: overrides.banner ?? null,
22
- });
23
- }
24
-
25
- describe('User', () => {
26
- describe('toString()', () => {
27
- it('returns user mention format', () => {
28
- const user = createUser({ id: '987654321098765432' });
29
- expect(user.toString()).toBe('<@987654321098765432>');
30
- });
31
- });
32
-
33
- describe('avatarURL()', () => {
34
- it('returns null when avatar is null', () => {
35
- const user = createUser({ avatar: null });
36
- expect(user.avatarURL()).toBeNull();
37
- });
38
-
39
- it('builds avatar URL with default png extension', () => {
40
- const user = createUser({ avatar: 'abc123hash' });
41
- const url = user.avatarURL();
42
- expect(url).toContain('fluxerusercontent.com/avatars/123456789012345678/abc123hash.png');
43
- });
44
-
45
- it('uses gif for animated avatar (a_ prefix)', () => {
46
- const user = createUser({ avatar: 'a_animatedhash' });
47
- const url = user.avatarURL();
48
- expect(url).toContain('.gif');
49
- });
50
-
51
- it('appends size when provided', () => {
52
- const user = createUser({ avatar: 'hash' });
53
- const url = user.avatarURL({ size: 256 });
54
- expect(url).toContain('?size=256');
55
- });
56
- });
57
-
58
- describe('displayAvatarURL()', () => {
59
- it('returns default avatar URL when no custom avatar', () => {
60
- const user = createUser({ avatar: null });
61
- const url = user.displayAvatarURL();
62
- expect(url).toContain('fluxerstatic.com/avatars/');
63
- });
64
-
65
- it('returns custom avatar URL when avatar is set', () => {
66
- const user = createUser({ avatar: 'custom' });
67
- const url = user.displayAvatarURL();
68
- expect(url).toContain('fluxerusercontent.com/avatars/');
69
- });
70
- });
71
-
72
- describe('bannerURL()', () => {
73
- it('returns null when banner is null', () => {
74
- const user = createUser({ banner: null });
75
- expect(user.bannerURL()).toBeNull();
76
- });
77
-
78
- it('builds banner URL when banner is set', () => {
79
- const user = createUser({ banner: 'bannerhash' });
80
- const url = user.bannerURL();
81
- expect(url).toContain('fluxerusercontent.com/banners/123456789012345678/bannerhash.png');
82
- });
83
- });
84
-
85
- describe('constructor', () => {
86
- it('parses API user data', () => {
87
- const user = createUser({
88
- id: '111',
89
- username: 'Alice',
90
- avatar: 'av',
91
- banner: 'bn',
92
- });
93
- expect(user.id).toBe('111');
94
- expect(user.username).toBe('Alice');
95
- expect(user.avatar).toBe('av');
96
- expect(user.banner).toBe('bn');
97
- });
98
-
99
- it('handles optional fields', () => {
100
- const user = new User(createMockClient(), {
101
- id: '1',
102
- username: 'Bot',
103
- discriminator: '0',
104
- });
105
- expect(user.globalName).toBeNull();
106
- expect(user.avatar).toBeNull();
107
- expect(user.bot).toBe(false);
108
- });
109
- });
110
- });
@@ -1,109 +0,0 @@
1
- import { Client } from '../client/Client.js';
2
- import { Base } from './Base.js';
3
- import { MessageSendOptions } from '../util/messageUtils.js';
4
- import { APIChannelPartial, APIUserPartial } from '@erinjs/types';
5
- import { Routes } from '@erinjs/types';
6
- import { CDN_URL } from '../util/Constants.js';
7
- import { cdnDefaultAvatarURL } from '../util/cdn.js';
8
- import { DMChannel } from './Channel.js';
9
- import { Message } from './Message';
10
-
11
- /** Represents a user (or bot) on Fluxer. */
12
- export class User extends Base {
13
- readonly client: Client;
14
- readonly id: string;
15
- username: string;
16
- discriminator: string;
17
- globalName: string | null;
18
- avatar: string | null;
19
- readonly bot: boolean;
20
- /** RGB avatar color (e.g. 7577782). Null if not set. */
21
- avatarColor: number | null;
22
- /** Public flags bitfield. Null if not set. */
23
- flags: number | null;
24
- /** Whether this is an official system user. */
25
- readonly system: boolean;
26
- /** Banner hash (from profile, member, or invite context). Null when not available. */
27
- banner: string | null;
28
-
29
- /** @param data - API user from message author, GET /users/{id}, or GET /users/@me */
30
- constructor(client: Client, data: APIUserPartial) {
31
- super();
32
- this.client = client;
33
- this.id = data.id;
34
- this.username = data.username;
35
- this.discriminator = data.discriminator;
36
- this.globalName = data.global_name ?? null;
37
- this.avatar = data.avatar ?? null;
38
- this.bot = !!data.bot;
39
- this.avatarColor = data.avatar_color ?? null;
40
- this.flags = data.flags ?? data.public_flags ?? null;
41
- this.system = !!data.system;
42
- this.banner = data.banner ?? null;
43
- }
44
-
45
- /** Update mutable fields from fresh API data. Used by getOrCreateUser cache. */
46
- _patch(data: APIUserPartial): void {
47
- this.username = data.username;
48
- this.discriminator = data.discriminator;
49
- this.globalName = data.global_name ?? null;
50
- this.avatar = data.avatar ?? null;
51
- if (data.avatar_color !== undefined) this.avatarColor = data.avatar_color;
52
- if (data.flags !== undefined) this.flags = data.flags;
53
- if (data.banner !== undefined) this.banner = data.banner;
54
- }
55
-
56
- /**
57
- * Get the URL for this user's avatar.
58
- * Auto-detects animated avatars (hash starting with `a_`) and uses gif extension.
59
- * @param options - Optional `size` and `extension` (default: png, or gif for animated)
60
- */
61
- avatarURL(options?: { size?: number; extension?: string }): string | null {
62
- if (!this.avatar) return null;
63
- const ext = this.avatar.startsWith('a_') ? 'gif' : (options?.extension ?? 'png');
64
- const size = options?.size ? `?size=${options.size}` : '';
65
- return `${CDN_URL}/avatars/${this.id}/${this.avatar}.${ext}${size}`;
66
- }
67
-
68
- /** Get the avatar URL, or the default avatar if none set (Fluxer: fluxerstatic.com). */
69
- displayAvatarURL(options?: { size?: number; extension?: string }): string {
70
- return this.avatarURL(options) ?? cdnDefaultAvatarURL(this.id);
71
- }
72
-
73
- /**
74
- * Get the URL for this user's banner.
75
- * Returns null if the user has no banner (only available when fetched from profile/member context).
76
- */
77
- bannerURL(options?: { size?: number; extension?: string }): string | null {
78
- if (!this.banner) return null;
79
- const ext = this.banner.startsWith('a_') ? 'gif' : (options?.extension ?? 'png');
80
- const size = options?.size ? `?size=${options.size}` : '';
81
- return `${CDN_URL}/banners/${this.id}/${this.banner}.${ext}${size}`;
82
- }
83
-
84
- /** Returns a mention string (e.g. `<@123456>`). */
85
- toString(): string {
86
- return `<@${this.id}>`;
87
- }
88
-
89
- /**
90
- * Create or get a DM channel with this user.
91
- * Returns the DM channel; use {@link DMChannel.send} to send messages.
92
- */
93
- async createDM(): Promise<DMChannel> {
94
- const data = await this.client.rest.post(Routes.userMeChannels(), {
95
- body: { recipient_id: this.id },
96
- auth: true,
97
- });
98
- return new DMChannel(this.client, data as APIChannelPartial);
99
- }
100
-
101
- /**
102
- * Send a DM to this user.
103
- * Convenience method that creates the DM channel and sends the message.
104
- */
105
- async send(options: MessageSendOptions): Promise<Message> {
106
- const dm = await this.createDM();
107
- return dm.send(options);
108
- }
109
- }
@@ -1,109 +0,0 @@
1
- import { describe, it, expect, vi } from 'vitest';
2
- import { Client, Webhook } from '../';
3
- import { Routes } from '@erinjs/types';
4
-
5
- function createMockClient() {
6
- const get = vi.fn();
7
- const del = vi.fn();
8
-
9
- const client = {
10
- rest: {
11
- get,
12
- delete: del,
13
- post: vi.fn(),
14
- patch: vi.fn(),
15
- put: vi.fn(),
16
- },
17
- getOrCreateUser: (data: { id: string; username?: string; discriminator?: string }) => ({
18
- id: data.id,
19
- username: data.username ?? 'user',
20
- discriminator: data.discriminator ?? '0',
21
- }),
22
- } as unknown as Client;
23
-
24
- return { client, get, del };
25
- }
26
-
27
- function createWebhook(client: Client, token: string | null = 'token123') {
28
- const data = {
29
- id: 'webhook1',
30
- guild_id: 'guild1',
31
- channel_id: 'channel1',
32
- name: 'Test Webhook',
33
- avatar: null,
34
- user: {
35
- id: 'user1',
36
- username: 'WebhookUser',
37
- discriminator: '0',
38
- },
39
- };
40
-
41
- return new Webhook(client, {
42
- ...data,
43
- ...(token ? { token } : {}),
44
- });
45
- }
46
-
47
- const mockMessagePayload = {
48
- id: 'message1',
49
- channel_id: 'channel1',
50
- author: {
51
- id: 'user1',
52
- username: 'WebhookUser',
53
- discriminator: '0',
54
- },
55
- type: 0,
56
- flags: 0,
57
- content: 'hello',
58
- timestamp: new Date().toISOString(),
59
- edited_timestamp: null,
60
- pinned: false,
61
- };
62
-
63
- describe('Webhook', () => {
64
- describe('fetchMessage()', () => {
65
- it('fetches a webhook message using token auth route', async () => {
66
- const { client, get } = createMockClient();
67
- get.mockResolvedValue(mockMessagePayload);
68
- const webhook = createWebhook(client);
69
-
70
- const message = await webhook.fetchMessage('message1');
71
-
72
- expect(get).toHaveBeenCalledWith(Routes.webhookMessage('webhook1', 'token123', 'message1'), {
73
- auth: false,
74
- });
75
- expect(message.id).toBe('message1');
76
- });
77
-
78
- it('throws when token is unavailable', async () => {
79
- const { client } = createMockClient();
80
- const webhook = createWebhook(client, null);
81
-
82
- await expect(webhook.fetchMessage('message1')).rejects.toThrow(
83
- 'Webhook token is required to fetch messages',
84
- );
85
- });
86
- });
87
-
88
- describe('deleteMessage()', () => {
89
- it('deletes a webhook message using token auth route', async () => {
90
- const { client, del } = createMockClient();
91
- const webhook = createWebhook(client);
92
-
93
- await webhook.deleteMessage('message1');
94
-
95
- expect(del).toHaveBeenCalledWith(Routes.webhookMessage('webhook1', 'token123', 'message1'), {
96
- auth: false,
97
- });
98
- });
99
-
100
- it('throws when token is unavailable', async () => {
101
- const { client } = createMockClient();
102
- const webhook = createWebhook(client, null);
103
-
104
- await expect(webhook.deleteMessage('message1')).rejects.toThrow(
105
- 'Webhook token is required to delete messages',
106
- );
107
- });
108
- });
109
- });
@@ -1,258 +0,0 @@
1
- import { Client } from '../client/Client.js';
2
- import { Base } from './Base.js';
3
- import { APIEmbed, APIMessage } from '@erinjs/types';
4
- import {
5
- APIWebhook,
6
- APIWebhookUpdateRequest,
7
- APIWebhookTokenUpdateRequest,
8
- APIWebhookEditMessageRequest,
9
- } from '@erinjs/types';
10
- import { Routes } from '@erinjs/types';
11
- import { EmbedBuilder } from '@erinjs/builders';
12
- import { buildSendBody, resolveMessageFiles, type MessageFileData } from '../util/messageUtils.js';
13
- import { Message } from './Message.js';
14
- import { User } from './User.js';
15
- import { cdnAvatarURL } from '../util/cdn.js';
16
-
17
- /** File data for webhook attachment uploads. Use `data` for buffers or `url` to fetch from a URL. */
18
- export type WebhookFileData = MessageFileData;
19
-
20
- /** Attachment metadata for webhook file uploads (id matches FormData index). */
21
- export interface WebhookAttachmentMeta {
22
- id: number;
23
- filename: string;
24
- title?: string | null;
25
- description?: string | null;
26
- /** MessageAttachmentFlags: IS_SPOILER (8), CONTAINS_EXPLICIT_MEDIA (16), IS_ANIMATED (32) */
27
- flags?: number;
28
- }
29
-
30
- /** Options for sending a message via webhook. Aligns with WebhookMessageRequest in the API. */
31
- export interface WebhookSendOptions {
32
- /** Message text content (up to 2000 characters) */
33
- content?: string;
34
- /** Embed objects. Use EmbedBuilder or APIEmbed; EmbedBuilder is serialized automatically. */
35
- embeds?: (APIEmbed | EmbedBuilder)[];
36
- /** Override the webhook's default username for this message */
37
- username?: string;
38
- /** Override the webhook's default avatar URL for this message */
39
- avatar_url?: string;
40
- /** Text-to-speech */
41
- tts?: boolean;
42
- /** File attachments. When present, uses multipart/form-data (same as channel.send). */
43
- files?: WebhookFileData[];
44
- /** Attachment metadata for files (id = index). Use when files are provided. */
45
- attachments?: WebhookAttachmentMeta[];
46
- }
47
-
48
- /**
49
- * Represents a Discord/Fluxer webhook. Supports creating, fetching, sending, and deleting.
50
- * The token is only available when the webhook was created; fetched webhooks cannot send messages.
51
- */
52
- export class Webhook extends Base {
53
- readonly client: Client;
54
- readonly id: string;
55
- readonly guildId: string;
56
- channelId: string;
57
- name: string;
58
- avatar: string | null;
59
- /** Present only when webhook was created via createWebhook(); not returned when fetching. */
60
- readonly token: string | null;
61
- /** User who created the webhook. */
62
- readonly user: User;
63
-
64
- /** @param data - API webhook from POST /channels/{id}/webhooks (has token) or GET /webhooks/{id} (no token) */
65
- constructor(client: Client, data: APIWebhook & { token?: string | null }) {
66
- super();
67
- this.client = client;
68
- this.id = data.id;
69
- this.guildId = data.guild_id;
70
- this.channelId = data.channel_id;
71
- this.name = data.name ?? 'Unknown';
72
- this.avatar = data.avatar ?? null;
73
- this.token = data.token ?? null;
74
- this.user = client.getOrCreateUser(data.user);
75
- }
76
-
77
- /**
78
- * Get the URL for this webhook's avatar.
79
- * Returns null if the webhook has no custom avatar.
80
- */
81
- avatarURL(options?: { size?: number; extension?: string }): string | null {
82
- return cdnAvatarURL(this.id, this.avatar, options);
83
- }
84
-
85
- /** Delete this webhook. Requires bot token with Manage Webhooks permission. */
86
- async delete(): Promise<void> {
87
- await this.client.rest.delete(Routes.webhook(this.id), { auth: true });
88
- }
89
-
90
- /**
91
- * Edit this webhook. With token: name and avatar only. Without token (bot auth): name, avatar, and channel_id.
92
- * @param options - Fields to update (name, avatar, channel_id when using bot auth)
93
- * @returns This webhook instance with updated fields
94
- */
95
- async edit(options: APIWebhookUpdateRequest | APIWebhookTokenUpdateRequest): Promise<Webhook> {
96
- const body: Record<string, unknown> = {};
97
- if (options.name !== undefined) body.name = options.name;
98
- if (options.avatar !== undefined) body.avatar = options.avatar;
99
- if ('channel_id' in options && options.channel_id !== undefined && !this.token) {
100
- body.channel_id = options.channel_id;
101
- }
102
-
103
- if (this.token) {
104
- const data = await this.client.rest.patch(Routes.webhookExecute(this.id, this.token), {
105
- body,
106
- auth: false,
107
- });
108
- const w = data as APIWebhook;
109
- this.name = w.name ?? this.name;
110
- this.avatar = w.avatar ?? null;
111
- return this;
112
- }
113
-
114
- const data = await this.client.rest.patch(Routes.webhook(this.id), {
115
- body,
116
- auth: true,
117
- });
118
- const w = data as APIWebhook;
119
- this.name = w.name ?? this.name;
120
- this.avatar = w.avatar ?? null;
121
- this.channelId = w.channel_id ?? this.channelId;
122
- return this;
123
- }
124
-
125
- /**
126
- * Send a message via this webhook. Requires the webhook token (only present when created, not when fetched).
127
- * @param options - Text content or object with content, embeds, username, avatar_url, tts, files, attachments
128
- * @param wait - If true, waits for the API and returns the created Message; otherwise returns void (204)
129
- * @throws Error if token is not available
130
- * @example
131
- * await webhook.send('Hello!');
132
- * await webhook.send({ embeds: [embed] });
133
- * await webhook.send({ content: 'File attached', files: [{ name: 'data.txt', data: buffer }] });
134
- * const msg = await webhook.send({ content: 'Hi' }, true);
135
- */
136
- async send(options: string | WebhookSendOptions, wait?: boolean): Promise<Message | undefined> {
137
- if (!this.token) {
138
- throw new Error(
139
- 'Webhook token is required to send. The token is only returned when creating a webhook; fetched webhooks cannot send.',
140
- );
141
- }
142
- const opts = typeof options === 'string' ? { content: options } : options;
143
-
144
- // Use same body-building flow as ChannelManager.send / message send
145
- const body = buildSendBody(opts) as Record<string, unknown>;
146
- if (opts.username !== undefined) body.username = opts.username;
147
- if (opts.avatar_url !== undefined) body.avatar_url = opts.avatar_url;
148
- if (opts.tts !== undefined) body.tts = opts.tts;
149
-
150
- const route = Routes.webhookExecute(this.id, this.token) + (wait ? '?wait=true' : '');
151
-
152
- // Same pattern as ChannelManager: { body, files } when files present (URLs resolved automatically)
153
- const files = opts.files?.length ? await resolveMessageFiles(opts.files) : undefined;
154
- const postOptions = files?.length
155
- ? { body, files, auth: false as const }
156
- : { body, auth: false as const };
157
-
158
- const data = await this.client.rest.post<APIMessage | undefined>(route, postOptions);
159
-
160
- if (wait && data) {
161
- return new Message(this.client, data);
162
- }
163
- return undefined;
164
- }
165
-
166
- /**
167
- * Edit a message previously sent by this webhook.
168
- * Requires the webhook token.
169
- * @param messageId - The ID of the message to edit
170
- * @param options - Fields to update (content, embeds, attachments)
171
- * @returns The updated Message
172
- * @throws Error if token is not available
173
- */
174
- async editMessage(messageId: string, options: APIWebhookEditMessageRequest): Promise<Message> {
175
- if (!this.token) {
176
- throw new Error(
177
- 'Webhook token is required to edit messages. The token is only returned when creating a webhook; fetched webhooks cannot edit messages.',
178
- );
179
- }
180
- const data = await this.client.rest.patch<APIMessage>(
181
- Routes.webhookMessage(this.id, this.token, messageId),
182
- { body: options as Record<string, unknown>, auth: false },
183
- );
184
- return new Message(this.client, data);
185
- }
186
-
187
- /**
188
- * Fetch a message sent by this webhook.
189
- * Requires the webhook token.
190
- * @param messageId - The ID of the message to fetch
191
- * @returns The message
192
- * @throws Error if token is not available
193
- */
194
- async fetchMessage(messageId: string): Promise<Message> {
195
- if (!this.token) {
196
- throw new Error(
197
- 'Webhook token is required to fetch messages. The token is only returned when creating a webhook; fetched webhooks cannot fetch messages.',
198
- );
199
- }
200
- const data = await this.client.rest.get<APIMessage>(
201
- Routes.webhookMessage(this.id, this.token, messageId),
202
- { auth: false },
203
- );
204
- return new Message(this.client, data);
205
- }
206
-
207
- /**
208
- * Delete a message sent by this webhook.
209
- * Requires the webhook token.
210
- * @param messageId - The ID of the message to delete
211
- * @throws Error if token is not available
212
- */
213
- async deleteMessage(messageId: string): Promise<void> {
214
- if (!this.token) {
215
- throw new Error(
216
- 'Webhook token is required to delete messages. The token is only returned when creating a webhook; fetched webhooks cannot delete messages.',
217
- );
218
- }
219
- await this.client.rest.delete(Routes.webhookMessage(this.id, this.token, messageId), {
220
- auth: false,
221
- });
222
- }
223
-
224
- /**
225
- * Fetch a webhook by ID using bot auth.
226
- * @param client - The client instance
227
- * @param webhookId - The webhook ID
228
- * @returns Webhook without token (cannot send)
229
- */
230
- static async fetch(client: Client, webhookId: string): Promise<Webhook> {
231
- const data = await client.rest.get(Routes.webhook(webhookId));
232
- return new Webhook(client, data as APIWebhook);
233
- }
234
-
235
- /**
236
- * Create a Webhook instance from an ID and token (e.g. from a stored webhook URL).
237
- * @param client - The client instance
238
- * @param webhookId - The webhook ID
239
- * @param token - The webhook token (from createWebhook or stored)
240
- * @param options - Optional channelId, guildId, name for display
241
- */
242
- static fromToken(
243
- client: Client,
244
- webhookId: string,
245
- token: string,
246
- options?: { channelId?: string; guildId?: string; name?: string },
247
- ): Webhook {
248
- return new Webhook(client, {
249
- id: webhookId,
250
- guild_id: options?.guildId ?? '',
251
- channel_id: options?.channelId ?? '',
252
- name: options?.name ?? 'Webhook',
253
- avatar: null,
254
- token,
255
- user: { id: '', username: 'webhook', discriminator: '0' },
256
- });
257
- }
258
- }
@@ -1,16 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { CDN_URL, STATIC_CDN_URL, DEFAULT_USER_AGENT } from './Constants.js';
3
-
4
- describe('Constants', () => {
5
- it('CDN_URL points to fluxerusercontent', () => {
6
- expect(CDN_URL).toBe('https://fluxerusercontent.com');
7
- });
8
-
9
- it('STATIC_CDN_URL points to fluxerstatic', () => {
10
- expect(STATIC_CDN_URL).toBe('https://fluxerstatic.com');
11
- });
12
-
13
- it('DEFAULT_USER_AGENT is erin.js', () => {
14
- expect(DEFAULT_USER_AGENT).toBe('erin.js');
15
- });
16
- });
@@ -1,7 +0,0 @@
1
- /** User Content CDN (avatars, icons, banners, emojis, attachments). */
2
- export const CDN_URL = 'https://fluxerusercontent.com';
3
-
4
- /** Static Assets CDN (default avatars). Use fluxerstatic.com for default avatars per Fluxer API. */
5
- export const STATIC_CDN_URL = 'https://fluxerstatic.com';
6
-
7
- export const DEFAULT_USER_AGENT = 'erin.js';
@@ -1,46 +0,0 @@
1
- /** Event name constants for client.on(Events.X, handler). Use with ClientEvents for typed callbacks. */
2
- export const Events = {
3
- Ready: 'ready',
4
- MessageCreate: 'messageCreate',
5
- MessageUpdate: 'messageUpdate',
6
- MessageDelete: 'messageDelete',
7
- MessageDeleteBulk: 'messageDeleteBulk',
8
- MessageReactionAdd: 'messageReactionAdd',
9
- MessageReactionRemove: 'messageReactionRemove',
10
- MessageReactionRemoveAll: 'messageReactionRemoveAll',
11
- MessageReactionRemoveEmoji: 'messageReactionRemoveEmoji',
12
- InteractionCreate: 'interactionCreate',
13
- GuildCreate: 'guildCreate',
14
- GuildUpdate: 'guildUpdate',
15
- GuildDelete: 'guildDelete',
16
- GuildBanAdd: 'guildBanAdd',
17
- GuildBanRemove: 'guildBanRemove',
18
- GuildEmojisUpdate: 'guildEmojisUpdate',
19
- GuildStickersUpdate: 'guildStickersUpdate',
20
- GuildIntegrationsUpdate: 'guildIntegrationsUpdate',
21
- GuildMemberAdd: 'guildMemberAdd',
22
- GuildMemberUpdate: 'guildMemberUpdate',
23
- GuildMemberRemove: 'guildMemberRemove',
24
- GuildRoleCreate: 'guildRoleCreate',
25
- GuildRoleUpdate: 'guildRoleUpdate',
26
- GuildRoleDelete: 'guildRoleDelete',
27
- GuildScheduledEventCreate: 'guildScheduledEventCreate',
28
- GuildScheduledEventUpdate: 'guildScheduledEventUpdate',
29
- GuildScheduledEventDelete: 'guildScheduledEventDelete',
30
- ChannelCreate: 'channelCreate',
31
- ChannelUpdate: 'channelUpdate',
32
- ChannelDelete: 'channelDelete',
33
- ChannelPinsUpdate: 'channelPinsUpdate',
34
- InviteCreate: 'inviteCreate',
35
- InviteDelete: 'inviteDelete',
36
- TypingStart: 'typingStart',
37
- UserUpdate: 'userUpdate',
38
- PresenceUpdate: 'presenceUpdate',
39
- VoiceStateUpdate: 'voiceStateUpdate',
40
- VoiceServerUpdate: 'voiceServerUpdate',
41
- VoiceStatesSync: 'voiceStatesSync',
42
- WebhooksUpdate: 'webhooksUpdate',
43
- Resumed: 'resumed',
44
- Error: 'error',
45
- Debug: 'debug',
46
- } as const;