* refactor(bot)!: setup desired properties for all transformers
SetupDesiredProps when is given an object that does not corrispond to a transformer object that supports desired properties will behave like TransformProperty on the entire object as when it tries to get the properties for said object it will find `never` as the props and for `IsKeyDesired` a props of `never` means that all props are desired.
* feat(transformers)!: Handle partials in transformers
* Add expiresAt to invite create event
* Use Equals helper, clean up a bit the code
* Explicit the IsKeyDesired TProps never behavior
* Fix type errors
* format
* Add all trasformer objects to bot.transformers.$inferredTypes
* Use transfromerInformations for bot.transformers.$inferredTypes
* code review
* code review
* fix component transformer
* fix
* Update packages/bot/src/transformers/types.ts
* Fixes from Tri (+ GPT sol) code review
---------
Co-authored-by: Link <link20050703@gmail.com>
- .devcontainer: we don't update it, we could keep it if we wanted
- .gitpod.yml: we don't need the .gitpod file, if someone uses gitpod they can install deps themself
- .helix: the config is out of date as it still uses prettier
- scripts/checkCpuModel.js: this script was used for benchmarks but we removed those
- scripts/generateMessage.js: this script was used for benchmarks but we removed those
- scripts/openApiSchema.js: this is a WIP script that was never finished and the discord open-api spec is preview
- .vscode/settings.json: the old tsdk config is deprecated, we now use the new js/ts.tsdk.path config instead
The comment change to InteractionCallbackOptions is included as it looks like there was a mistake as "create-guild-application-command-json-params" does not have a with_response parameter
* feat: Remove fzstd
Given node v20 EOL, we can now drop fzstd in favor of node:zlib's zstd implementation
* ci: Bump bun and deno
We don't really have a support policy for deno and bun (for node is the supported upstream) so we bump them to the latest versions
---------
Co-authored-by: Awesome Stickz <38146668+AwesomeStickz@users.noreply.github.com>
* refactor(bot)!: setup desired properties for all transformers
SetupDesiredProps when is given an object that does not corrispond to a transformer object that supports desired properties will behave like TransformProperty on the entire object as when it tries to get the properties for said object it will find `never` as the props and for `IsKeyDesired` a props of `never` means that all props are desired.
* Use Equals helper, clean up a bit the code
* Explicit the IsKeyDesired TProps never behavior
* fix(bot): Bug with return type in functions
* fix(bot)!: Split DiscordSelectComponent into specific select components
And add missing resolved property from the responses, since this now correctly transformers the responses, resolved has to be added.
The reverse transformer does not transform resolved as it requires a bunch of others, such as a user, role, message reverse transformers etc.
* Apply suggestions from code review
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* Update permissions for community invites
Use payload_json for invite creation with file upload
The TODO in INVITE_CREATE is to be done after #4436 gets merged as it splits the transformer logic between gateway and the normal invite object, placing the event transformation code in the event itself
* Community invites breaking changes
* fix(rest): Use Retry-After header for retrying requests
According to discord docs: Your application should rely on the Retry-After header [...] to determine when to retry the request.
* also use in processHeaders()
---------
Co-authored-by: Awesome Stickz <kiran121102@gmail.com>
* refactor(bot)!: setup desired properties for all transformers
SetupDesiredProps when is given an object that does not corrispond to a transformer object that supports desired properties will behave like TransformProperty on the entire object as when it tries to get the properties for said object it will find `never` as the props and for `IsKeyDesired` a props of `never` means that all props are desired.
* Use Equals helper, clean up a bit the code
* Explicit the IsKeyDesired TProps never behavior
* fix(bot): Bug with return type in functions
* refactor(bot)!: setup desired properties for all transformers
SetupDesiredProps when is given an object that does not corrispond to a transformer object that supports desired properties will behave like TransformProperty on the entire object as when it tries to get the properties for said object it will find `never` as the props and for `IsKeyDesired` a props of `never` means that all props are desired.
* Use Equals helper, clean up a bit the code
* Explicit the IsKeyDesired TProps never behavior
* Add all trasformer objects to bot.transformers.$inferredTypes
* api-docs: Community Invites
Add support for invites that gives roles to users.
Add support for target users on invites.
Sort-of unrleated change required: `restManager.makeRequest` `resolve` function had to changed or else the `getTargetUsers` would hang forever due to a JSON parsing issue.
* fix type error & add bot helpers
* fix(rest)!: Remove calculateBits from changeToDiscordFormat
The rest manager currently has to assume that request bodies that have "permissions", "allow", "deny", "defaultMemberPermissions" fields are always meant as a permissions.
If these are not, for user error or future discord changes, this will break.
Also Discord expects these as strings, and discordeno does not abstract too much from the discord api, so it doesn't really makes sense for us to accept PermissionStrings[], the user should call calculateBits themselves, there is an argument to be made about accepting bigints since these are bitfields but that's another discussion.
* Channel.permissionOverwrites use PermissionStrings
For the transformed type we can keep the fact that it uses PermissionStrings
* Fix e2e test
* remove comment
Queues currenly suppress errors, making it very hard to figure out if there is a parse error for example
This fixes it as it add debug logs and passes the error object along with the rejection in sendRequest and does reject the promise in the queue instead of silently ignoring it
This now reflects the updated information about the scope, we do not include the links to the form nor the TOS & privacy policy note as those are better suited for the dev docs instead.
Currently if a queue is pending deletion or waiting to refill its ratelimit will keep the process alive, this is not ideal for scripts like command deployment ones
This does not impact the functionality of the queues in any way, just allows the process to exit if nothing else is pending in which case you would be loosing the ratelimit information anyway
I prefer semicolors, they also help avoiding certain pitfalls in JavaScript/TypeScript, such as the following code sample:
```js
const xyz = "test"
(something.else as string) = "another"
```
This results in a TypeError: "test" is not a function, this is because js thinks we are trying to call the string "test" as a function.
To fix this it requires a `;` somewhere before the `(`, such as `;(something ... ` which in my opinion is ugly and less clean overall.
* fix(rest): Always encode URI component in routes
Instead of using the implicit behavior of `fetch` and `Request` we do it explicitly in the routes.
* Add checks for numbers and digits-only strings
* Add option to disable uri encode
* Merge mocha config file
* Simplify scripts, remove coverage path fixing
Codecov is able to fix the coverage paths on its own
* Readd coveragePathFixing script
* Fix coverage path fix script
* Use a turbo remote cache server for CI
`rharkor/caching-for-turbo` uses github actions cache to provide a remote cache server for turbo, so we can use previuously created cache if available and requested by turbo, and this doesn't have the downside of having the cache growing indefinitely like with normal github actions cache as since the single caches are uploaded to the github actions cache, github can evict the old cache when it's not used or there is no space left.
Also add turbo to website so we can cache the build
* Use turbo for website build & build:doc
* fix typo, tubo -> turbo
---------
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
Using `after` in the single tests is a bit messy as it runs after all the tests and if one fails sometime it won't run properly.
This approach uses a single `afterEach` hook to clean up all resources created during the tests after each test run.
Also remove `async` from describe functions as it is not supported and can lead to issues
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
* feat(components): File upload component for modals
* Update comments
upstream has been merged into the file uploads pr
* reverse transform, comment typo fix
* feat(utils): Add base64url encoding
RFC 7636 (Proof Key for Code Exchange by OAuth Public Clients) requires to encode the data with base64url encoding.
We don't support decoding as we don't need it for PKCE.
* feat(oauth2): Add PKCE support
* make PKCE code verifier optional, fixup comments
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
Updated desiredProperties in transformers to be generic so that it can be used to retrive the bot desired properties, and removed the option from `CreateBotOptions.transformers.desiredProperties` as that would cause the typings for the bot to be incorrect
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* api-docs!: Modal Selects
* Fix transformer to handle the new response types
* Remove `Component` for consistency
Other interaction response types do not have `Component` in their names, so neither should the TextDisplay and Label interaction response types.
* Fix type errors in component transformers
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
* chore(website): Remove styled-components
This also allows us to remove the loading screen on page load as the styles are now loaded by the browser itself.
* chore(website): Update dependencies
* Remove clsx
* Update dependencies
Also update markdown onBrokenMarkdownLinks options as it now deprecated in favor of markdown.hooks.onBrokenMarkdownLinks
* Update dependencies