* 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>
* 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
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
The typedoc config is now only in the top-level config file instead of also being one per package
and all internal APIs are now marked as private so typedoc won't generate documentation for them, however we still need to export them to avoid typedoc warnings
The new internal APIs that are exported, since are marked as `@private` can have breaking changes without notices
* fix(types)!: Split and fix discordeno.ts
* fix some mistakes
* remove now not needed @ts-expect-error
* Apply code review suggestions
* Fix test type errors
* Revert "Apply code review suggestions"
This reverts commit 7a0cea84b3.
* Restore some of the changes from the revert
---------
Co-authored-by: Link <lts20050703@gmail.com>
* 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>
* 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>
* feat: add missing params to getThreadMember() and getThreadMembers()
* add member property from payload in threadMember transformer
* mark guildId as BigString | undefined and pass undefined in threadMember transformer
* fix type of after, limit params of ListThreadMembers
* add tsdoc for GetThreadMember and GetGuildAuditLog
* make options param of getThreadMember() and getThreadMembers() optional
---------
Co-authored-by: Fleny <Fleny113@outlook.com>
* docs: update header to v20
* Update to upcoming version instead
* Use the new DISCORDENO_VERSION
* Use the new DISCORDENO_VERSION
* Update website/docs/bigbot/step-2-rest.md
---------
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
Co-authored-by: Fleny <Fleny113@outlook.com>