* fix: finish bucket file coverage
* Update packages/utils/tests/bucket.spec.ts
Co-authored-by: Jonathan Ho <heiheiho000@gmail.com>
---------
Co-authored-by: Jonathan Ho <heiheiho000@gmail.com>
* refactor(rest)!: refactor `sendRequest`
- Removed `url` in favour of `route`. This change will effectively remove a bunch of unnecessary checks from dd. Also this changes how rest proxies have to pass the route to the `makeRequest` function. But since it will just require you to pass `req.route + req.query` it is an improvement compared to `rest.baseUrl + req.route + req.query`.
- Introduced `HttpResponseCodes` an internal enum to remove magic numbers.
- Improved the rate limted response handling. Made it simpler.
- Removed unnecessary `JSON.stringify(await result.json())` since `await result.text()` does effectively the same.
- Changed the anti memor leak `response.json()` to `response.arrayBuffer()` since latter does not do any additional processing.
* .
* forgot to fix that
Currently the route definitions make `createRestManager` massive. Moving them to their own creator function makes it a bit easier to handle.
Also `sessionInfo` has been removed since it's just an alias to `gatewayBot`. Instead `gatewayBot` should be used.
It has been removed since the routes are mainly used internally in the lib. Almost no one should need to touch them outside, but if they do they should know how routes are called.
* refactor(rest): remove falsy token check
This is in favour for interaction only bots, which still need rest but cannot provide a valid bot token.
If you want to use rest for your normal bot it should be your own responsibility to pass a valid token.
Further more `applicationId` is now a required property since we cannot extract the id from the token anymore.
* forgot to commit that
* fix error
* make appid optional again
* app id throw error if undefined
* fix test
Currently we use a double negation in the code which makes it harder to understand what it actually does.
Therefore the check has been changed to be understood easier.
* refactor(rest): interaction handling
Currently some interaction handling uses `sendRequest` directly.
This adds the `runThroughQueue` option, which prevents the request to be handled by a queue effectively giving the same effect as using `sendRequest` directly.
This prevents code repetition and supports future endpoints which might not have a rate limit too.
Further more all interaction related endpoints have now been set to not send the bots authorization header.
* fix invalid file
* fix eslint
* fix: followups have a rate limit
* fix awaiting
* refactor!(rest): rest proxy attachment sending
Currently attachments get encoded as base64 before being send to the proxy. This is not really necessary, instead we can just send `FormData` to the proxy.
* fix lint
* fix(rest, types)!: support auditlog reason
Improved the consistency by separating the audit log reason to an optional function parameter.
Also added support for 100% documented reason endpoints.
* missing stuff
* fix this
* fix e3e
* fix(transformers): message transformer using different style
* fix: more bench tests
* fix(bench): token can not be empty
* more desired props
* fix: bug on message.id props
* fix: transfomrer errors on bench
---------
Co-authored-by: Jonathan Ho <heiheiho000@gmail.com>