* Rework the test for urlToBase64.
Currently urlToBase64 used the website logo however with #3990 the test
started failing as the logo changed so the base64 of it changed.
The test now mocks fetch() to return 8 empty bytes and checks for that
base64 string instead
* test: explicity import beforeeach and aftereach
* test: stub depend on runtime
* test: use try catch instead
* test: try itoh typeof
---------
Co-authored-by: H01001000 <heiheiho000@gmail.com>
* Update docs for desired properties
* Update examples to use createBot desiredProperties
The BigBot and reaction roles examples use the Discordeno CLI
* Migrate examples to v19 stable
* Docs work
* Add type helpers for typeLevel based desired props
This also fixes / added a few stuff that was missing in exiting
types & transformers, however due to this a few transformers got a
breaking change due to the need to pass down the shardId
* Fix benchmark type error
* Add the generics to createBot / Bot / ..
This caused a lot of breaking changed due to the required generics on a
bunch of types
* Fix benchmark type error?
* Fix benchmarks type error
* Fix E2E test type error
* remove defaultDesiredPropertiesValue
* Remove `internal` jsdoc from CompleteDesiredProprieties
* Add tests for createDesiredPropertiesObject
* Fix interaction.bot type
* Remove Capitalize type helper
It is already built-in into typescript as an intrinsic
* Fix typo
* Update message on missing desired properties
* Fix CI
* Move infer types to 'transformers.$inferredTypes'
* Fix CI
* Fix CI, again
* Use GatewayHandlers in params of create function
* change default behavior to remove key
* Fix CI
* fix types for e2e test
* Attempt to fix shard reconnecting in a loop
* Add a bit of logging on READY & RESUMED
* Fix integration tests
* Revert turbo.json change
* Pass down the logger to LeakyBucket on HELLO
* Update some logs
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Add webhook events types
We will not support all the signing part for the handling of http
requests, however we do still provide the types for these requests
* Apply suggestions from code review
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Use union on DiscordEventWebhookEventBody data
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Add zlib-stream transport-compression support
* remove external buffer, add the url param
this also fixes the CI Deno error
* use a queue and promises
instead of calling handleDiscordPacket from the callback of inflate.on('data')
* Add zstd support
* Re-add payload compression, set fzstd as optional, refactor
* add comment for decompressionPromisesQueue
* fix comment for isCompressed
* Don't create a new Uint8Array if the input is a Buffer
* Use a Uint8Array buffer instead of parsing incomplete JSON chunks
* remove old commented code
* Change ts expect error message
* use type import for ShardGatewayConfig
* Apply suggestions from code review
Co-authored-by: LTS (Link) <lts20050703@gmail.com>
---------
Co-authored-by: LTS (Link) <lts20050703@gmail.com>
* Update website deps, remove 1s load time
* Run biome migrate
* Test without terser plugin
* Do not always default to MDX
* remove webpack terser plugin
* Add some exclusions to website/tsconfig
* Use the native WebSocket implementation when available
* merge types.js import in shard
* Apply suggestions from code review
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Do not use the WebSocket global on Node
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Use a _ check instead of the manual one on the switch
* invert the check, as the current one is wrong
* move the check to before indexing the object
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Add env to test:e2e turbo task
Turbo in v2 does not pass down the environment variables unless manually specified (by default)
* use the correct env name for the test guild
* Improve logging, keep shard collections separated
* revert to erroring in getSessionInfo. Fill the value in createBot
* removed useless if
* remove same number of shards check
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Update manager.ts
* revert shard.events.message assignment for the spread
* use new Collection instead of .clear() + for-of
* Use fixed formula and note in the comment the inaccuracy
* Apply suggestions from code review
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Add a remark to shardsFullPercentage to let the user know of the inaccuracy
* Update comment and add a clearInterval
The clearInterval is not strictly needed, however it is better to ensure there is always one and only one internal running at a given point
* revert check for all shards online
It was bugged as gateway.resharding.shards gets populated overtime and not instantly
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Move transformers types to a single file
* Add script to test TS Compiler api capabilities
Remove nested objects where possible
* Use Partial<Role> and DiscordOverwrite instead of objects in AuditLogChange
* Fix typescript errors
* Remove interfaces.json
It is a generated file from the test script, not something that should be commited
* Start work on the test generation script
The TS version got bumped to 5.5.3
* Fix any type, use node16 module resolution
"node" is a deprecated alias for "node10", node16 is the recommended
Add code to check for type errors when getting the types from the interfaces
Fix errors when TS tries to find the files that the root tsconfig.json handles
* remove some useless compile options in TSApiTest
* Add jsdoc parsing
JSDoc tags with the next right after are not supported
* fix small format issue
* Fix ApplicationCommandPermissions todo
* Fix CI error
* Simplify parseDocumentation
* get type directly from the sourceFile
* remove hasUndefinedUnion as it is no longer used
* fix discordeno bin file name
* Update the yarn lockfile
* Merge scripts into one
* Use `@internal` instead of `@private` + `@deprecated`
* work on .d.ts files
* Process interface members once
* Move emit/preEmit diagnostics to a unit test
they can take quite a while, even 3-4 seconds, so running in the CLI every time does not seem ideal
* test: add build:types to test:unit dependencies
This is a test commit, it will provably get reversed. The scope is to see what CI does with this
* add find-up to deno import map
* add typescript to the deno import map
* Add node:assert to deno import map
* check for this.timeout that exists
deno does not have the timeout
* add build:type to deno-unit
* Temp hack to work-around the script deno tests
* Test with bun running the test as well
* fix turbo deps for unit tests
* remove test scripts
* Update CI to use build:type cache
* Apply code review suggestion
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
* Add code to modify the interface member
* use an actual config
The config source is still a dummy object for now
* Search and use discordeno.config.js file
* provide config from cli options
* Handle props in base objects
The dependencies of an object need to be declared/updated manually, it would be painful to fix this in such a way that would be something that Typescript can give us from the compiler API
* add some tests for desired proprieties
* also check for a .mjs config file
* Add support for .ts config files
We use the typescript compiler to emit an in-memory version of the config file, import it and then remove it. It does not do bundling so if the config imports local files it will not work. Also the file is not type-checked as it would slow down the config loading
* remove compiler host, use callback on program.emit
* fix deno ci error
* add node:fs/promises to deno import map
---------
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
* Update turbo to v2
Also some small config changes
* Remove test for the non-exiting "client" pkg
* Re-add build:type dependency to lint
* Add missing comma
* Use turbo in build:watch
* Fix biome formatting of package.json files to match the yarn one
* Ignore package.json
This includes a format on the member toggles as that pr got merged while using ESLint formatting and it didn't get updated before merging
* Add flags field to ModifyGuildMember
Also add the GuildMemberFlags enum as that was missing
* Add flags to member object
* Fix type error
* Update member transformer
* Readd flags desired propriety
* Rename enum to MemberFlag for consitency
* Rename to GuildMemberFlags, use number not the enum itself
* Use ToggleBitfield for flags
* Add getters
* Fix build error
* Merge flags in toggles
* change flags getter to return the actual flags
And not our custom toggles values
* Fix reverse transformer
* Migrate eslint and prettier to biomejs
This does NOT include examples/bigbot as it has its own formatter
* Update to biome 1.8.0
* Readd dotenv dev dependency to rest
During a merge it got lost
* Do some code changes & run prettier and eslint
* Fix test:test-type script
* Apply code review suggestions
* update heartbeat interval & add a reason for the specific value
* Fix husky error
* Update to TS 5.5
And use ${configDir}
* Fix test.json tsconfig base
---------
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
* Migrate beginner and minimal bot to discordeno v19
* Add .swcrc and fix minimal yarn.lock
* update .gitignore files
* Update nodejs template
Discordeno.js (DD v13) -> DD v19 "raw"
Currently the permission checking is not working correctly
* Fix permission issue
* Rename the templates
* remove unused indents
* Rename starter to beginner
So now it is minimal (main branch) -> beginner
* Really small refactor & eslint fixes (bigbot template)
This is to make my life less miserable at a later time
* mark rabbitMQ plugins as binary files
git seems to be treating them as text
* Add v19 bigbot rest
* Add gateway code
and rabbitmq_message_deduplication v0.6.2 plugin
* fix yarn messy semevr version for @types/amqplib
* clear channel con amqp connection close
* Add bot code for bigbot v19
missing prisma setup, collector setup & language setup
* Add localization
The "command versioning" system works the same say as before, but instead of a command version the code updates the commands every time they change based on the SHA1 of the commands
* Use file relative paths instead of cwd relative paths
* Fix todos
* revert autocomplete tests
* Revert "Add localization"
This reverts commit 2b1da8d2cd.
* move env assertion to config.ts
* Add shard ping to /ping
* fix small issue
* Update readme files
* use Date.now() for the bigbot REST ping
* Remove bigbot v16 code
* Add docker (compose) setup to bigbot template
* remove healthchecks from rest & gateway
* Update dependencies of examples
* Apply readme(s) suggestions from code review
Hopefully i haven't missed any related to markdown files
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
* Apply code suggestions from code review
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
---------
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
* Add flags enums
* Remove extra MessageFlags enum from `@discordeno/bot`
This is not a breaking in itself as `@discordeno/types` has this enum
* Fix CI error, remove usage of MessageFlags and SkuFlags
* Revert "remove usage of MessageFlags and SkuFlags"
This reverts part of commit 954b347ebb.
* fix ci error
* Add GetReactions#type & DiscordReactionType
* Add burst and burstColors to reaction add/remove events
The reaction remove event only has burst, not burstColors
* Add type to message reaction add/remove
* Fix type error
---------
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>