@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.
- package/{core/LICENSE → LICENSE} +203 -203
- package/README.md +46 -0
- package/dist/index.d.mts +2084 -0
- package/dist/index.d.ts +2084 -0
- package/dist/index.js +3867 -0
- package/dist/index.mjs +3809 -0
- package/package.json +50 -15
- package/core/.changeset/README.md +0 -8
- package/core/.changeset/community-bootstrap-release.md +0 -17
- package/core/.changeset/config.json +0 -11
- package/core/.changeset/no-changelog.js +0 -16
- package/core/.changeset/pre.json +0 -17
- package/core/.editorconfig +0 -13
- package/core/.gitattributes +0 -2
- package/core/.github/CODE_OF_CONDUCT.md +0 -23
- package/core/.github/FUNDING.yml +0 -7
- package/core/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
- package/core/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
- package/core/.github/PULL_REQUEST_TEMPLATE.md +0 -16
- package/core/.github/dependabot.yml +0 -16
- package/core/.github/workflows/autoapp.yml +0 -16
- package/core/.github/workflows/ci.yml +0 -187
- package/core/.github/workflows/codeql.yml +0 -30
- package/core/.github/workflows/deploy-docs.yml +0 -54
- package/core/.github/workflows/publish.yml +0 -43
- package/core/.lintstagedrc.json +0 -4
- package/core/.nvmrc +0 -1
- package/core/.prettierignore +0 -8
- package/core/.prettierrc +0 -11
- package/core/CONTRIBUTING.md +0 -70
- package/core/README.md +0 -61
- package/core/SECURITY.md +0 -21
- package/core/apps/docs/index.html +0 -28
- package/core/apps/docs/middleware.ts +0 -21
- package/core/apps/docs/package.json +0 -33
- package/core/apps/docs/public/@flux.png +0 -0
- package/core/apps/docs/public/docs/latest/guides.json +0 -1420
- package/core/apps/docs/public/docs/latest/main.json +0 -14981
- package/core/apps/docs/public/docs/latest/rag-index.json +0 -1
- package/core/apps/docs/public/docs/v1.0.5/guides.json +0 -226
- package/core/apps/docs/public/docs/v1.0.5/main.json +0 -7920
- package/core/apps/docs/public/docs/v1.0.6/guides.json +0 -226
- package/core/apps/docs/public/docs/v1.0.6/main.json +0 -7920
- package/core/apps/docs/public/docs/v1.0.7/guides.json +0 -259
- package/core/apps/docs/public/docs/v1.0.7/main.json +0 -8652
- package/core/apps/docs/public/docs/v1.0.8/guides.json +0 -313
- package/core/apps/docs/public/docs/v1.0.8/main.json +0 -9618
- package/core/apps/docs/public/docs/v1.0.9/guides.json +0 -319
- package/core/apps/docs/public/docs/v1.0.9/main.json +0 -10694
- package/core/apps/docs/public/docs/v1.1.0/guides.json +0 -589
- package/core/apps/docs/public/docs/v1.1.0/main.json +0 -12576
- package/core/apps/docs/public/docs/v1.1.2/guides.json +0 -650
- package/core/apps/docs/public/docs/v1.1.2/main.json +0 -13239
- package/core/apps/docs/public/docs/v1.1.3/guides.json +0 -650
- package/core/apps/docs/public/docs/v1.1.3/main.json +0 -13239
- package/core/apps/docs/public/docs/v1.1.4/guides.json +0 -708
- package/core/apps/docs/public/docs/v1.1.4/main.json +0 -13231
- package/core/apps/docs/public/docs/v1.1.5/guides.json +0 -1035
- package/core/apps/docs/public/docs/v1.1.5/main.json +0 -13838
- package/core/apps/docs/public/docs/v1.1.6/guides.json +0 -1041
- package/core/apps/docs/public/docs/v1.1.6/main.json +0 -14313
- package/core/apps/docs/public/docs/v1.1.8/guides.json +0 -1047
- package/core/apps/docs/public/docs/v1.1.8/main.json +0 -14421
- package/core/apps/docs/public/docs/v1.1.9/guides.json +0 -1047
- package/core/apps/docs/public/docs/v1.1.9/main.json +0 -14421
- package/core/apps/docs/public/docs/v1.2.0/guides.json +0 -1212
- package/core/apps/docs/public/docs/v1.2.0/main.json +0 -14663
- package/core/apps/docs/public/docs/v1.2.1/guides.json +0 -1293
- package/core/apps/docs/public/docs/v1.2.1/main.json +0 -14828
- package/core/apps/docs/public/docs/v1.2.2/guides.json +0 -1293
- package/core/apps/docs/public/docs/v1.2.2/main.json +0 -15025
- package/core/apps/docs/public/docs/v1.2.3/guides.json +0 -1420
- package/core/apps/docs/public/docs/v1.2.3/main.json +0 -14954
- package/core/apps/docs/public/docs/v1.2.4/guides.json +0 -1420
- package/core/apps/docs/public/docs/v1.2.4/main.json +0 -14981
- package/core/apps/docs/public/docs/versions.json +0 -24
- package/core/apps/docs/public/flux.png +0 -0
- package/core/apps/docs/public/locales/en.json +0 -50
- package/core/apps/docs/public/locales/guides-en.json +0 -512
- package/core/apps/docs/public/robots.txt +0 -4
- package/core/apps/docs/public/sitemap.xml +0 -33
- package/core/apps/docs/src/App.vue +0 -538
- package/core/apps/docs/src/components/ApiCategorySection.vue +0 -42
- package/core/apps/docs/src/components/ApiDiscordCompat.vue +0 -65
- package/core/apps/docs/src/components/ApiEndpointCard.vue +0 -313
- package/core/apps/docs/src/components/ApiSchemaBlock.vue +0 -131
- package/core/apps/docs/src/components/CodeBlock.vue +0 -177
- package/core/apps/docs/src/components/CommunityCallout.vue +0 -90
- package/core/apps/docs/src/components/ConstructorSection.vue +0 -82
- package/core/apps/docs/src/components/DocDescription.vue +0 -40
- package/core/apps/docs/src/components/FluxerLogo.vue +0 -3
- package/core/apps/docs/src/components/Footer.vue +0 -106
- package/core/apps/docs/src/components/GuideCodeBlock.vue +0 -102
- package/core/apps/docs/src/components/GuideDiscordCompat.vue +0 -77
- package/core/apps/docs/src/components/GuideDiscordCompatCallout.vue +0 -83
- package/core/apps/docs/src/components/GuideTable.vue +0 -77
- package/core/apps/docs/src/components/GuideTip.vue +0 -38
- package/core/apps/docs/src/components/MethodsSection.vue +0 -195
- package/core/apps/docs/src/components/ParamsTable.vue +0 -70
- package/core/apps/docs/src/components/PropertiesSection.vue +0 -143
- package/core/apps/docs/src/components/SearchBar.vue +0 -76
- package/core/apps/docs/src/components/SearchModal.vue +0 -361
- package/core/apps/docs/src/components/SidebarNav.vue +0 -225
- package/core/apps/docs/src/components/SponsorBanner.vue +0 -153
- package/core/apps/docs/src/components/TypeSignature.vue +0 -187
- package/core/apps/docs/src/components/VersionPicker.vue +0 -191
- package/core/apps/docs/src/composables/useSearchIndex.ts +0 -144
- package/core/apps/docs/src/composables/useVersionedPath.ts +0 -20
- package/core/apps/docs/src/data/apiEndpoints.ts +0 -1073
- package/core/apps/docs/src/data/changelog.ts +0 -717
- package/core/apps/docs/src/data/guides.ts +0 -2362
- package/core/apps/docs/src/env.d.ts +0 -7
- package/core/apps/docs/src/locales/guides-en.json +0 -512
- package/core/apps/docs/src/main.ts +0 -27
- package/core/apps/docs/src/pages/ApiReferenceLayout.vue +0 -175
- package/core/apps/docs/src/pages/ApiReferencePage.vue +0 -128
- package/core/apps/docs/src/pages/Changelog.vue +0 -288
- package/core/apps/docs/src/pages/ClassPage.vue +0 -319
- package/core/apps/docs/src/pages/ClassesList.vue +0 -100
- package/core/apps/docs/src/pages/DocsLayout.vue +0 -127
- package/core/apps/docs/src/pages/GuidePage.vue +0 -279
- package/core/apps/docs/src/pages/GuidesIndex.vue +0 -166
- package/core/apps/docs/src/pages/GuidesLayout.vue +0 -245
- package/core/apps/docs/src/pages/Home.vue +0 -125
- package/core/apps/docs/src/pages/NotFound.vue +0 -57
- package/core/apps/docs/src/pages/TypedefPage.vue +0 -230
- package/core/apps/docs/src/pages/TypedefsList.vue +0 -168
- package/core/apps/docs/src/pages/VersionLayout.vue +0 -15
- package/core/apps/docs/src/router.ts +0 -73
- package/core/apps/docs/src/stores/docs.ts +0 -54
- package/core/apps/docs/src/stores/guides.ts +0 -53
- package/core/apps/docs/src/stores/version.ts +0 -67
- package/core/apps/docs/src/styles/main.css +0 -278
- package/core/apps/docs/src/styles/prism.css +0 -95
- package/core/apps/docs/src/types/doc-schema.ts +0 -112
- package/core/apps/docs/tsconfig.json +0 -17
- package/core/apps/docs/tsconfig.node.json +0 -10
- package/core/apps/docs/vite.config.d.ts +0 -2
- package/core/apps/docs/vite.config.js +0 -26
- package/core/apps/docs/vite.config.ts +0 -28
- package/core/apps/docs-vitepress/.vitepress/config.ts +0 -141
- package/core/apps/docs-vitepress/api-data/latest/main.json +0 -15035
- package/core/apps/docs-vitepress/api-data/v1.2.4/main.json +0 -15035
- package/core/apps/docs-vitepress/api-data/versions.json +0 -6
- package/core/apps/docs-vitepress/index.md +0 -15
- package/core/apps/docs-vitepress/package-lock.json +0 -2924
- package/core/apps/docs-vitepress/package.json +0 -20
- package/core/apps/docs-vitepress/public/CNAME +0 -1
- package/core/apps/docs-vitepress/scripts/generate-api.ts +0 -243
- package/core/apps/docs-vitepress/scripts/migrate-guides.ts +0 -129
- package/core/apps/docs-vitepress/tsconfig.json +0 -11
- package/core/apps/docs-vitepress/v/latest/guides/attachments-by-url.md +0 -57
- package/core/apps/docs-vitepress/v/latest/guides/attachments.md +0 -62
- package/core/apps/docs-vitepress/v/latest/guides/basic-bot.md +0 -49
- package/core/apps/docs-vitepress/v/latest/guides/channels.md +0 -180
- package/core/apps/docs-vitepress/v/latest/guides/deprecated-apis.md +0 -58
- package/core/apps/docs-vitepress/v/latest/guides/discord-js-compatibility.md +0 -42
- package/core/apps/docs-vitepress/v/latest/guides/editing-embeds.md +0 -65
- package/core/apps/docs-vitepress/v/latest/guides/embed-media.md +0 -87
- package/core/apps/docs-vitepress/v/latest/guides/embeds.md +0 -166
- package/core/apps/docs-vitepress/v/latest/guides/emojis.md +0 -77
- package/core/apps/docs-vitepress/v/latest/guides/events.md +0 -202
- package/core/apps/docs-vitepress/v/latest/guides/gifs.md +0 -47
- package/core/apps/docs-vitepress/v/latest/guides/installation.md +0 -10
- package/core/apps/docs-vitepress/v/latest/guides/moderation.md +0 -89
- package/core/apps/docs-vitepress/v/latest/guides/permissions.md +0 -130
- package/core/apps/docs-vitepress/v/latest/guides/prefix-commands.md +0 -41
- package/core/apps/docs-vitepress/v/latest/guides/profile-urls.md +0 -58
- package/core/apps/docs-vitepress/v/latest/guides/reactions.md +0 -69
- package/core/apps/docs-vitepress/v/latest/guides/roles.md +0 -130
- package/core/apps/docs-vitepress/v/latest/guides/sending-without-reply.md +0 -172
- package/core/apps/docs-vitepress/v/latest/guides/voice.md +0 -109
- package/core/apps/docs-vitepress/v/latest/guides/wait-for-guilds.md +0 -37
- package/core/apps/docs-vitepress/v/latest/guides/webhook-attachments-embeds.md +0 -73
- package/core/apps/docs-vitepress/v/latest/guides/webhooks.md +0 -131
- package/core/eslint.config.js +0 -80
- package/core/examples/.env.example +0 -22
- package/core/examples/README.md +0 -68
- package/core/examples/first-steps-bot.js +0 -118
- package/core/examples/minimal-bot.js +0 -17
- package/core/examples/moderation-bot.js +0 -209
- package/core/examples/package.json +0 -14
- package/core/examples/ping-bot.js +0 -1146
- package/core/examples/reaction-bot.js +0 -70
- package/core/examples/reaction-roles-bot.js +0 -140
- package/core/examples/webhook-bot.js +0 -239
- package/core/flux.png +0 -0
- package/core/package.json +0 -78
- package/core/packages/builders/package.json +0 -51
- package/core/packages/builders/src/index.ts +0 -13
- package/core/packages/builders/src/messages/AttachmentBuilder.test.ts +0 -79
- package/core/packages/builders/src/messages/AttachmentBuilder.ts +0 -69
- package/core/packages/builders/src/messages/EmbedBuilder.test.ts +0 -266
- package/core/packages/builders/src/messages/EmbedBuilder.ts +0 -239
- package/core/packages/builders/src/messages/MessagePayload.test.ts +0 -118
- package/core/packages/builders/src/messages/MessagePayload.ts +0 -122
- package/core/packages/builders/tsconfig.json +0 -9
- package/core/packages/builders/tsup.config.ts +0 -9
- package/core/packages/builders/vitest.config.ts +0 -9
- package/core/packages/collection/package.json +0 -47
- package/core/packages/collection/src/Collection.test.ts +0 -232
- package/core/packages/collection/src/Collection.ts +0 -196
- package/core/packages/collection/src/index.ts +0 -1
- package/core/packages/collection/tsconfig.json +0 -9
- package/core/packages/collection/tsup.config.ts +0 -9
- package/core/packages/collection/vitest.config.ts +0 -9
- package/core/packages/docgen/package.json +0 -26
- package/core/packages/docgen/src/extract.ts +0 -262
- package/core/packages/docgen/src/formatType.ts +0 -24
- package/core/packages/docgen/src/index.ts +0 -103
- package/core/packages/docgen/src/schema.ts +0 -100
- package/core/packages/docgen/src/visitor.ts +0 -147
- package/core/packages/docgen/tsconfig.json +0 -9
- package/core/packages/docgen/tsup.config.ts +0 -9
- package/core/packages/fluxer-core/README.md +0 -26
- package/core/packages/fluxer-core/package.json +0 -60
- package/core/packages/fluxer-core/src/client/ChannelManager.ts +0 -143
- package/core/packages/fluxer-core/src/client/Client.gateway.test.ts +0 -84
- package/core/packages/fluxer-core/src/client/Client.resolveEmoji.test.ts +0 -45
- package/core/packages/fluxer-core/src/client/Client.ts +0 -558
- package/core/packages/fluxer-core/src/client/ClientUser.ts +0 -40
- package/core/packages/fluxer-core/src/client/EventHandlerRegistry.ts +0 -469
- package/core/packages/fluxer-core/src/client/GuildManager.ts +0 -79
- package/core/packages/fluxer-core/src/client/GuildMemberManager.ts +0 -91
- package/core/packages/fluxer-core/src/client/MessageManager.ts +0 -58
- package/core/packages/fluxer-core/src/client/UsersManager.ts +0 -122
- package/core/packages/fluxer-core/src/errors/ErrorCodes.test.ts +0 -19
- package/core/packages/fluxer-core/src/errors/ErrorCodes.ts +0 -12
- package/core/packages/fluxer-core/src/errors/FluxerError.test.ts +0 -32
- package/core/packages/fluxer-core/src/errors/FluxerError.ts +0 -15
- package/core/packages/fluxer-core/src/index.ts +0 -85
- package/core/packages/fluxer-core/src/structures/Base.ts +0 -7
- package/core/packages/fluxer-core/src/structures/Channel.ts +0 -508
- package/core/packages/fluxer-core/src/structures/Guild.test.ts +0 -189
- package/core/packages/fluxer-core/src/structures/Guild.ts +0 -734
- package/core/packages/fluxer-core/src/structures/GuildBan.ts +0 -35
- package/core/packages/fluxer-core/src/structures/GuildEmoji.ts +0 -57
- package/core/packages/fluxer-core/src/structures/GuildMember.test.ts +0 -203
- package/core/packages/fluxer-core/src/structures/GuildMember.ts +0 -213
- package/core/packages/fluxer-core/src/structures/GuildMemberRoleManager.ts +0 -121
- package/core/packages/fluxer-core/src/structures/GuildSticker.ts +0 -56
- package/core/packages/fluxer-core/src/structures/Invite.test.ts +0 -103
- package/core/packages/fluxer-core/src/structures/Invite.ts +0 -121
- package/core/packages/fluxer-core/src/structures/Message.test.ts +0 -109
- package/core/packages/fluxer-core/src/structures/Message.ts +0 -397
- package/core/packages/fluxer-core/src/structures/MessageReaction.ts +0 -72
- package/core/packages/fluxer-core/src/structures/PartialMessage.ts +0 -12
- package/core/packages/fluxer-core/src/structures/Role.test.ts +0 -77
- package/core/packages/fluxer-core/src/structures/Role.ts +0 -112
- package/core/packages/fluxer-core/src/structures/User.test.ts +0 -110
- package/core/packages/fluxer-core/src/structures/User.ts +0 -109
- package/core/packages/fluxer-core/src/structures/Webhook.test.ts +0 -109
- package/core/packages/fluxer-core/src/structures/Webhook.ts +0 -258
- package/core/packages/fluxer-core/src/util/Constants.test.ts +0 -16
- package/core/packages/fluxer-core/src/util/Constants.ts +0 -7
- package/core/packages/fluxer-core/src/util/Events.ts +0 -46
- package/core/packages/fluxer-core/src/util/MessageCollector.ts +0 -87
- package/core/packages/fluxer-core/src/util/Options.ts +0 -33
- package/core/packages/fluxer-core/src/util/ReactionCollector.ts +0 -116
- package/core/packages/fluxer-core/src/util/cdn.test.ts +0 -108
- package/core/packages/fluxer-core/src/util/cdn.ts +0 -130
- package/core/packages/fluxer-core/src/util/guildUtils.ts +0 -33
- package/core/packages/fluxer-core/src/util/messageUtils.test.ts +0 -74
- package/core/packages/fluxer-core/src/util/messageUtils.ts +0 -119
- package/core/packages/fluxer-core/src/util/permissions.test.ts +0 -95
- package/core/packages/fluxer-core/src/util/permissions.ts +0 -43
- package/core/packages/fluxer-core/tsconfig.json +0 -9
- package/core/packages/fluxer-core/tsup.config.ts +0 -9
- package/core/packages/fluxer-core/vitest.config.ts +0 -9
- package/core/packages/rest/package.json +0 -52
- package/core/packages/rest/src/REST.test.ts +0 -64
- package/core/packages/rest/src/REST.ts +0 -90
- package/core/packages/rest/src/RateLimitManager.test.ts +0 -71
- package/core/packages/rest/src/RateLimitManager.ts +0 -60
- package/core/packages/rest/src/RequestManager.test.ts +0 -87
- package/core/packages/rest/src/RequestManager.ts +0 -172
- package/core/packages/rest/src/errors/FluxerAPIError.test.ts +0 -57
- package/core/packages/rest/src/errors/FluxerAPIError.ts +0 -21
- package/core/packages/rest/src/errors/HTTPError.test.ts +0 -55
- package/core/packages/rest/src/errors/HTTPError.ts +0 -25
- package/core/packages/rest/src/errors/RateLimitError.test.ts +0 -41
- package/core/packages/rest/src/errors/RateLimitError.ts +0 -15
- package/core/packages/rest/src/errors/index.ts +0 -3
- package/core/packages/rest/src/index.ts +0 -6
- package/core/packages/rest/src/utils/constants.test.ts +0 -31
- package/core/packages/rest/src/utils/constants.ts +0 -5
- package/core/packages/rest/src/utils/files.test.ts +0 -37
- package/core/packages/rest/src/utils/files.ts +0 -75
- package/core/packages/rest/tsconfig.json +0 -9
- package/core/packages/rest/tsup.config.ts +0 -9
- package/core/packages/rest/vitest.config.ts +0 -9
- package/core/packages/types/package.json +0 -46
- package/core/packages/types/src/api/ban.ts +0 -8
- package/core/packages/types/src/api/channel.ts +0 -65
- package/core/packages/types/src/api/embed.ts +0 -82
- package/core/packages/types/src/api/emoji.ts +0 -12
- package/core/packages/types/src/api/errors.ts +0 -68
- package/core/packages/types/src/api/gateway.ts +0 -14
- package/core/packages/types/src/api/guild.ts +0 -123
- package/core/packages/types/src/api/index.ts +0 -15
- package/core/packages/types/src/api/instance.ts +0 -32
- package/core/packages/types/src/api/interaction.ts +0 -26
- package/core/packages/types/src/api/invite.ts +0 -28
- package/core/packages/types/src/api/message.ts +0 -140
- package/core/packages/types/src/api/role.ts +0 -41
- package/core/packages/types/src/api/sticker.ts +0 -14
- package/core/packages/types/src/api/user.ts +0 -79
- package/core/packages/types/src/api/webhook.ts +0 -41
- package/core/packages/types/src/common/index.ts +0 -1
- package/core/packages/types/src/common/snowflake.test.ts +0 -9
- package/core/packages/types/src/common/snowflake.ts +0 -8
- package/core/packages/types/src/gateway/events.ts +0 -189
- package/core/packages/types/src/gateway/index.ts +0 -3
- package/core/packages/types/src/gateway/opcodes.ts +0 -17
- package/core/packages/types/src/gateway/payloads.ts +0 -481
- package/core/packages/types/src/index.ts +0 -4
- package/core/packages/types/src/rest/index.ts +0 -1
- package/core/packages/types/src/rest/routes.test.ts +0 -169
- package/core/packages/types/src/rest/routes.ts +0 -109
- package/core/packages/types/tsconfig.json +0 -9
- package/core/packages/types/tsup.config.ts +0 -9
- package/core/packages/types/vitest.config.ts +0 -9
- package/core/packages/util/package.json +0 -51
- package/core/packages/util/src/BitField.test.ts +0 -96
- package/core/packages/util/src/BitField.ts +0 -105
- package/core/packages/util/src/MessageFlagsBitField.test.ts +0 -42
- package/core/packages/util/src/MessageFlagsBitField.ts +0 -20
- package/core/packages/util/src/PermissionsBitField.test.ts +0 -79
- package/core/packages/util/src/PermissionsBitField.ts +0 -97
- package/core/packages/util/src/SnowflakeUtil.test.ts +0 -69
- package/core/packages/util/src/SnowflakeUtil.ts +0 -65
- package/core/packages/util/src/UserFlagsBitField.test.ts +0 -39
- package/core/packages/util/src/UserFlagsBitField.ts +0 -48
- package/core/packages/util/src/deprecation.test.ts +0 -44
- package/core/packages/util/src/deprecation.ts +0 -28
- package/core/packages/util/src/emojiShortcodes.generated.ts +0 -5
- package/core/packages/util/src/emojiShortcodes.test.ts +0 -41
- package/core/packages/util/src/emojiShortcodes.ts +0 -22
- package/core/packages/util/src/formatters.test.ts +0 -65
- package/core/packages/util/src/formatters.ts +0 -35
- package/core/packages/util/src/index.ts +0 -34
- package/core/packages/util/src/resolvers.test.ts +0 -198
- package/core/packages/util/src/resolvers.ts +0 -127
- package/core/packages/util/src/tenorUtils.test.ts +0 -75
- package/core/packages/util/src/tenorUtils.ts +0 -86
- package/core/packages/util/tsconfig.json +0 -9
- package/core/packages/util/tsup.config.ts +0 -9
- package/core/packages/util/vitest.config.ts +0 -9
- package/core/packages/voice/README.md +0 -42
- package/core/packages/voice/package.json +0 -67
- package/core/packages/voice/src/LiveKitRtcConnection.receive.test.ts +0 -24
- package/core/packages/voice/src/LiveKitRtcConnection.ts +0 -1767
- package/core/packages/voice/src/VoiceConnection.ts +0 -413
- package/core/packages/voice/src/VoiceManager.receive.test.ts +0 -61
- package/core/packages/voice/src/VoiceManager.test.ts +0 -44
- package/core/packages/voice/src/VoiceManager.ts +0 -503
- package/core/packages/voice/src/exports.test.ts +0 -38
- package/core/packages/voice/src/index.ts +0 -51
- package/core/packages/voice/src/livekit.test.ts +0 -48
- package/core/packages/voice/src/livekit.ts +0 -33
- package/core/packages/voice/src/mp4box.d.ts +0 -32
- package/core/packages/voice/src/opusUtils.test.ts +0 -29
- package/core/packages/voice/src/opusUtils.ts +0 -86
- package/core/packages/voice/src/streamPreviewPlaceholder.test.ts +0 -16
- package/core/packages/voice/src/streamPreviewPlaceholder.ts +0 -8
- package/core/packages/voice/src/ws.d.ts +0 -1
- package/core/packages/voice/tsconfig.json +0 -5
- package/core/packages/voice/tsup.config.ts +0 -10
- package/core/packages/voice/vitest.config.ts +0 -9
- package/core/packages/ws/package.json +0 -52
- package/core/packages/ws/src/WebSocketManager.ts +0 -130
- package/core/packages/ws/src/WebSocketShard.ts +0 -296
- package/core/packages/ws/src/index.ts +0 -12
- package/core/packages/ws/src/utils/constants.test.ts +0 -46
- package/core/packages/ws/src/utils/constants.ts +0 -22
- package/core/packages/ws/src/utils/getWebSocket.ts +0 -55
- package/core/packages/ws/src/ws.d.ts +0 -10
- package/core/packages/ws/tsconfig.json +0 -9
- package/core/packages/ws/tsup.config.ts +0 -9
- package/core/pnpm-lock.yaml +0 -7033
- package/core/pnpm-workspace.yaml +0 -4
- package/core/scripts/generate-ai-rag.ts +0 -240
- package/core/scripts/generate-docs.ts +0 -143
- package/core/scripts/generate-emoji-shortcodes.ts +0 -58
- package/core/scripts/generate-types.ts +0 -6
- package/core/scripts/publish-ordered.js +0 -63
- package/core/scripts/test-cjs-require.mjs +0 -43
- package/core/scripts/test-esm-imports.mjs +0 -42
- package/core/scripts/test-package-exports.mjs +0 -98
- package/core/scripts/test-smoke.mjs +0 -103
- package/core/tsconfig.json +0 -18
- package/core/turbo.json +0 -30
- package/core/vitest.config.ts +0 -17
- package/core/wrangler.jsonc +0 -9
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@erinjs/core",
|
|
3
|
-
"publishConfig": {
|
|
4
|
-
"access": "public"
|
|
5
|
-
},
|
|
6
|
-
"version": "1.2.4",
|
|
7
|
-
"description": "A fully-featured SDK for Fluxer bots",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/blstmo-abandoned-us-for-the-milk/core.git",
|
|
11
|
-
"directory": "packages/fluxer-core"
|
|
12
|
-
},
|
|
13
|
-
"bugs": "https://github.com/blstmo-abandoned-us-for-the-milk/core/issues",
|
|
14
|
-
"homepage": "https://github.com/blstmo-abandoned-us-for-the-milk/core#readme",
|
|
15
|
-
"keywords": [
|
|
16
|
-
"fluxer",
|
|
17
|
-
"discord",
|
|
18
|
-
"sdk",
|
|
19
|
-
"bot",
|
|
20
|
-
"api"
|
|
21
|
-
],
|
|
22
|
-
"license": "Apache-2.0",
|
|
23
|
-
"main": "./dist/index.js",
|
|
24
|
-
"module": "./dist/index.mjs",
|
|
25
|
-
"types": "./dist/index.d.ts",
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./dist/index.d.ts",
|
|
29
|
-
"import": "./dist/index.mjs",
|
|
30
|
-
"require": "./dist/index.js"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"files": [
|
|
34
|
-
"dist"
|
|
35
|
-
],
|
|
36
|
-
"scripts": {
|
|
37
|
-
"build": "tsup",
|
|
38
|
-
"clean": "rm -rf dist",
|
|
39
|
-
"lint": "eslint src --max-warnings 0 --config ../../eslint.config.js",
|
|
40
|
-
"lint:fix": "eslint src --fix --config ../../eslint.config.js",
|
|
41
|
-
"test": "vitest run --passWithNoTests",
|
|
42
|
-
"test:coverage": "vitest run --coverage"
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"@erinjs/rest": "workspace:*",
|
|
46
|
-
"@erinjs/ws": "workspace:*",
|
|
47
|
-
"@erinjs/builders": "workspace:*",
|
|
48
|
-
"@erinjs/collection": "workspace:*",
|
|
49
|
-
"@erinjs/util": "workspace:*",
|
|
50
|
-
"@erinjs/types": "workspace:*"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@types/node": "^20.0.0",
|
|
54
|
-
"tsup": "^8.3.0",
|
|
55
|
-
"typescript": "^5.6.0"
|
|
56
|
-
},
|
|
57
|
-
"engines": {
|
|
58
|
-
"node": ">=18.0.0"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { Collection } from '@erinjs/collection';
|
|
2
|
-
import { APIChannel, APIMessage, Routes } from '@erinjs/types';
|
|
3
|
-
import { emitDeprecationWarning } from '@erinjs/util';
|
|
4
|
-
import { FluxerAPIError, RateLimitError } from '@erinjs/rest';
|
|
5
|
-
import { FluxerError } from '../errors/FluxerError.js';
|
|
6
|
-
import { ErrorCodes } from '../errors/ErrorCodes.js';
|
|
7
|
-
import { buildSendBody, resolveMessageFiles } from '../util/messageUtils.js';
|
|
8
|
-
import { MessageSendOptions } from '../util/messageUtils.js';
|
|
9
|
-
import { Client } from './Client.js';
|
|
10
|
-
import { Channel, GuildChannel } from '../structures/Channel.js';
|
|
11
|
-
import { Message } from '../structures/Message';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Manages channels with fetch and send.
|
|
15
|
-
* Extends Collection so you can use .get(), .set(), .filter(), etc.
|
|
16
|
-
*/
|
|
17
|
-
export class ChannelManager extends Collection<string, Channel | GuildChannel> {
|
|
18
|
-
private readonly maxSize: number;
|
|
19
|
-
|
|
20
|
-
constructor(private readonly client: Client) {
|
|
21
|
-
super();
|
|
22
|
-
this.maxSize = client.options?.cache?.channels ?? 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
override set(key: string, value: Channel): this {
|
|
26
|
-
if (this.maxSize > 0 && this.size >= this.maxSize && !this.has(key)) {
|
|
27
|
-
const firstKey = this.keys().next().value;
|
|
28
|
-
if (firstKey !== undefined) this.delete(firstKey);
|
|
29
|
-
}
|
|
30
|
-
return super.set(key, value);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Get a channel from cache or fetch from the API if not present.
|
|
35
|
-
* Convenience helper to avoid repeating `client.channels.get(id) ?? (await client.channels.fetch(id))`.
|
|
36
|
-
* @param channelId - Snowflake of the channel
|
|
37
|
-
* @returns The channel
|
|
38
|
-
* @throws FluxerError with CHANNEL_NOT_FOUND if the channel does not exist
|
|
39
|
-
* @example
|
|
40
|
-
* const channel = await client.channels.resolve(message.channelId);
|
|
41
|
-
* if (channel?.isTextBased()) await channel.send('Hello!');
|
|
42
|
-
*/
|
|
43
|
-
async resolve(channelId: string): Promise<Channel> {
|
|
44
|
-
return this.get(channelId) ?? this.fetch(channelId);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Fetch a channel by ID from the API (or return from cache if present).
|
|
49
|
-
* @param channelId - Snowflake of the channel
|
|
50
|
-
* @returns The channel
|
|
51
|
-
* @throws FluxerError with CHANNEL_NOT_FOUND if the channel does not exist
|
|
52
|
-
* @example
|
|
53
|
-
* const channel = await client.channels.fetch(channelId);
|
|
54
|
-
* if (channel?.isTextBased()) await channel.send('Hello!');
|
|
55
|
-
*/
|
|
56
|
-
async fetch(channelId: string): Promise<Channel> {
|
|
57
|
-
const cached = this.get(channelId);
|
|
58
|
-
if (cached) return cached;
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
const data = await this.client.rest.get<APIChannel>(Routes.channel(channelId));
|
|
62
|
-
const channel = Channel.fromOrCreate(this.client, data);
|
|
63
|
-
if (!channel) {
|
|
64
|
-
throw new FluxerError('Channel data invalid or unsupported type', {
|
|
65
|
-
code: ErrorCodes.ChannelNotFound,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
this.set(channel.id, channel);
|
|
69
|
-
if ('guildId' in channel) {
|
|
70
|
-
const guild = this.client.guilds.get(channel.guildId);
|
|
71
|
-
if (guild) guild.channels.set(channel.id, channel);
|
|
72
|
-
}
|
|
73
|
-
return channel;
|
|
74
|
-
} catch (err) {
|
|
75
|
-
if (err instanceof RateLimitError) throw err;
|
|
76
|
-
if (err instanceof FluxerAPIError && err.statusCode === 404) {
|
|
77
|
-
throw new FluxerError(`Channel ${channelId} not found`, {
|
|
78
|
-
code: ErrorCodes.ChannelNotFound,
|
|
79
|
-
cause: err,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
throw err instanceof FluxerError
|
|
83
|
-
? err
|
|
84
|
-
: new FluxerError(String(err), { cause: err as Error });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Fetch a message by ID from the API.
|
|
90
|
-
* @param channelId - Snowflake of the channel
|
|
91
|
-
* @param messageId - Snowflake of the message
|
|
92
|
-
* @returns The message
|
|
93
|
-
* @throws FluxerError with MESSAGE_NOT_FOUND if the message does not exist
|
|
94
|
-
* @deprecated Use channel.messages.fetch(messageId). Prefer (await client.channels.resolve(channelId))?.messages?.fetch(messageId).
|
|
95
|
-
* @example
|
|
96
|
-
* const channel = await client.channels.resolve(channelId);
|
|
97
|
-
* const message = await channel?.messages?.fetch(messageId);
|
|
98
|
-
*/
|
|
99
|
-
async fetchMessage(channelId: string, messageId: string): Promise<Message> {
|
|
100
|
-
emitDeprecationWarning(
|
|
101
|
-
'ChannelManager.fetchMessage()',
|
|
102
|
-
'Use channel.messages.fetch(messageId). Prefer (await client.channels.resolve(channelId))?.messages?.fetch(messageId).',
|
|
103
|
-
);
|
|
104
|
-
try {
|
|
105
|
-
const data = await this.client.rest.get<APIMessage>(
|
|
106
|
-
Routes.channelMessage(channelId, messageId),
|
|
107
|
-
);
|
|
108
|
-
return new Message(this.client, data);
|
|
109
|
-
} catch (err) {
|
|
110
|
-
if (err instanceof RateLimitError) throw err;
|
|
111
|
-
if (err instanceof FluxerAPIError && err.statusCode === 404) {
|
|
112
|
-
throw new FluxerError(`Message ${messageId} not found in channel ${channelId}`, {
|
|
113
|
-
code: ErrorCodes.MessageNotFound,
|
|
114
|
-
cause: err,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
throw err instanceof FluxerError
|
|
118
|
-
? err
|
|
119
|
-
: new FluxerError(String(err), { cause: err as Error });
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Send a message to a channel by ID. Works even when the channel is not cached.
|
|
125
|
-
* Skips the fetch when you only need to send.
|
|
126
|
-
* @param channelId - Snowflake of the channel (text channel or DM)
|
|
127
|
-
* @param payload - Text content or object with content, embeds, and/or files
|
|
128
|
-
* @returns The created message
|
|
129
|
-
* @example
|
|
130
|
-
* await client.channels.send(logChannelId, 'User joined!');
|
|
131
|
-
* await client.channels.send(channelId, { embeds: [embed] });
|
|
132
|
-
* await client.channels.send(channelId, { content: 'Report', files: [{ name: 'log.txt', data }] });
|
|
133
|
-
*/
|
|
134
|
-
async send(channelId: string, payload: string | MessageSendOptions): Promise<Message> {
|
|
135
|
-
const opts = typeof payload === 'string' ? { content: payload } : payload;
|
|
136
|
-
const body = buildSendBody(payload);
|
|
137
|
-
const files = opts.files?.length ? await resolveMessageFiles(opts.files) : undefined;
|
|
138
|
-
const postOptions = files?.length ? { body, files } : { body };
|
|
139
|
-
const data = await this.client.rest.post(Routes.channelMessages(channelId), postOptions);
|
|
140
|
-
this.client._addMessageToCache(channelId, data as APIMessage);
|
|
141
|
-
return new Message(this.client, data as APIMessage);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { Routes } from '@erinjs/types';
|
|
3
|
-
import { Client } from './Client.js';
|
|
4
|
-
import { Events } from '../util/Events.js';
|
|
5
|
-
import { Invite } from '../structures/Invite.js';
|
|
6
|
-
|
|
7
|
-
describe('Client gateway helpers and dispatch', () => {
|
|
8
|
-
let client: Client;
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
client = new Client();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('fetchGatewayInfo() fetches gateway metadata from /gateway/bot', async () => {
|
|
15
|
-
const gatewayInfo = {
|
|
16
|
-
url: 'wss://gateway.fluxer.app',
|
|
17
|
-
shards: 2,
|
|
18
|
-
session_start_limit: {
|
|
19
|
-
total: 1000,
|
|
20
|
-
remaining: 999,
|
|
21
|
-
reset_after: 60000,
|
|
22
|
-
max_concurrency: 1,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
const get = vi.spyOn(client.rest, 'get').mockResolvedValue(gatewayInfo);
|
|
26
|
-
|
|
27
|
-
const result = await client.fetchGatewayInfo();
|
|
28
|
-
|
|
29
|
-
expect(get).toHaveBeenCalledWith(Routes.gatewayBot());
|
|
30
|
-
expect(result).toEqual(gatewayInfo);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('emits InviteCreate for partial INVITE_CREATE payloads and logs debug metadata', async () => {
|
|
34
|
-
const emit = vi.spyOn(client, 'emit');
|
|
35
|
-
|
|
36
|
-
await (
|
|
37
|
-
client as unknown as { handleDispatch: (payload: unknown) => Promise<void> }
|
|
38
|
-
).handleDispatch({
|
|
39
|
-
op: 0,
|
|
40
|
-
t: 'INVITE_CREATE',
|
|
41
|
-
d: {
|
|
42
|
-
code: 'abc123',
|
|
43
|
-
guild_id: 'g1',
|
|
44
|
-
channel_id: 'c1',
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const inviteCall = emit.mock.calls.find((call) => call[0] === Events.InviteCreate);
|
|
49
|
-
expect(inviteCall).toBeTruthy();
|
|
50
|
-
const invite = inviteCall?.[1] as Invite;
|
|
51
|
-
expect(invite).toBeInstanceOf(Invite);
|
|
52
|
-
expect(invite.code).toBe('abc123');
|
|
53
|
-
expect(invite.guild.id).toBe('g1');
|
|
54
|
-
expect(invite.channel.id).toBe('c1');
|
|
55
|
-
|
|
56
|
-
const debugCall = emit.mock.calls.find(
|
|
57
|
-
(call) => call[0] === Events.Debug && String(call[1]).includes('INVITE_CREATE code=abc123'),
|
|
58
|
-
);
|
|
59
|
-
expect(debugCall).toBeTruthy();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('ignores malformed INVITE_CREATE payloads without code and logs debug message', async () => {
|
|
63
|
-
const emit = vi.spyOn(client, 'emit');
|
|
64
|
-
|
|
65
|
-
await (
|
|
66
|
-
client as unknown as { handleDispatch: (payload: unknown) => Promise<void> }
|
|
67
|
-
).handleDispatch({
|
|
68
|
-
op: 0,
|
|
69
|
-
t: 'INVITE_CREATE',
|
|
70
|
-
d: {
|
|
71
|
-
guild_id: 'g1',
|
|
72
|
-
channel_id: 'c1',
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
expect(emit.mock.calls.some((call) => call[0] === Events.InviteCreate)).toBe(false);
|
|
77
|
-
const debugCall = emit.mock.calls.find(
|
|
78
|
-
(call) =>
|
|
79
|
-
call[0] === Events.Debug &&
|
|
80
|
-
String(call[1]).includes('INVITE_CREATE payload had no invite code'),
|
|
81
|
-
);
|
|
82
|
-
expect(debugCall).toBeTruthy();
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
import { Client } from './Client.js';
|
|
3
|
-
|
|
4
|
-
describe('Client.resolveEmoji', () => {
|
|
5
|
-
let client: Client;
|
|
6
|
-
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
client = new Client();
|
|
9
|
-
vi.spyOn(client.rest, 'get').mockResolvedValue([]);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('resolves unicode shortcode :heart: to raw unicode (for URL encoding by route)', async () => {
|
|
13
|
-
const result = await client.resolveEmoji(':heart:');
|
|
14
|
-
expect(result).toBeTruthy();
|
|
15
|
-
expect(typeof result).toBe('string');
|
|
16
|
-
expect(result).not.toMatch(/^%.*%$/); // should NOT be pre-encoded
|
|
17
|
-
expect(client.rest.get).not.toHaveBeenCalled();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('resolves object with id without guild lookup', async () => {
|
|
21
|
-
const result = await client.resolveEmoji({
|
|
22
|
-
name: 'custom',
|
|
23
|
-
id: '123456789012345678',
|
|
24
|
-
});
|
|
25
|
-
expect(result).toContain('custom');
|
|
26
|
-
expect(result).toContain('123456789012345678');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('resolves name:id string format', async () => {
|
|
30
|
-
const result = await client.resolveEmoji('CustomEmoji:123456789012345678');
|
|
31
|
-
expect(result).toContain('CustomEmoji');
|
|
32
|
-
expect(result).toContain('123456789012345678');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('resolves <:name:id> mention format', async () => {
|
|
36
|
-
const result = await client.resolveEmoji('<:custom:123456789012345678>');
|
|
37
|
-
expect(result).toContain('custom');
|
|
38
|
-
expect(result).toContain('123456789012345678');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('returns raw unicode for direct unicode input', async () => {
|
|
42
|
-
const result = await client.resolveEmoji('❤');
|
|
43
|
-
expect(result).toBe('❤');
|
|
44
|
-
});
|
|
45
|
-
});
|