* Spawn one shard at a time
* remove useless code in ShardIdentified handling
* update comment on tellWorkerToIdentify
* fix mistake
* Use request identify
This also makes some unrelated changes needed to make the example
comple when using the build from this branch.
* remove debug logs
The limit is still in place however it is 40 total,
so it is a bit more complicated to explain and the discord docs
are better at doing so than what we can do with JSDoc
* Remove incorrect, reorder and fixes in channel
- Updated comments to be more clear
- Remove `Channel.newly_created`, doesn't seem to exist in the api docs
- Fix nullability for some fields
- Remove DiscordActiveThreads, DiscordArchivedThreads and DiscordListActiveThreads as they don't seem to match anything in the api
* Add back DiscordListActiveThreads but under Guild
and fix type errors
* Update packages/types/src/discord/channel.ts
Co-authored-by: LTS (Link) <lts20050703@gmail.com>
* Revert newly_created removal
* Apply suggestions from code review
Co-authored-by: LTS (Link) <lts20050703@gmail.com>
---------
Co-authored-by: LTS (Link) <lts20050703@gmail.com>
* Update Slash Command Command Name regex
* Update comments to reflect the change
* Use the correct apostrophe in the regex
While the docs use the regular ', discord accepts
the unicode apostrophe ʼ.
* Add lobby support
* Fix CI
Apparently for extends a bot was a LobbyMember since both had
a required id property and even if LobbyMember had other properties
as well that did not matter
* update LobbyMember flags to use ToggleBitfield
While discord does not say anything explicit about deprecating the
createGuildFromTemplate endpoint, it is a fair assumption to make that
it is included in this change
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Fix optionals for some props in autoModeration.
Also fix some comments to be more clear
* Fix type error in automodActionExecution
* Fix type error in automod.spec.ts e2e test
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Keep state to avoid unwanted disconnections
This keeps a state to know that we wanted to end the connection with a
code of 1000 or 1001 to avoid unwanted disconnections in case discord /
someone in the middle of the TCP connection (such as cloudflare) sends a
close code of 1000 or 1001.
* Apply suggestions from code review
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Use mocha for both deno and bun
* Use any Bun 1.1
* remove build:type dependency in lib-check.yml
* Pin point 1.1.42
* remove packages/bot/.mocharc.json
* Remove TBot, Use SetupDesiredProps
* Remove even more clutter from intellisense
* Use type instead of interfaces for some types
This avoids the need for mapped types in Bot
* docs: add info about removing ts clutter to desired props guide
* docs: improve ts clutter section in desired props guide more
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Fix type errors when using commandOptionsParser
* remove export from TransformProperty
* use TransformProperty in InteractionResolvedData
* Fix CI
* Remove the union on GetErrorWhenUndesired
* 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