Commit Graph

84 Commits

Author SHA1 Message Date
Fleny
bb6b8df2cf Add get sticker pack endpoint (#3844) 2024-08-10 19:36:29 -05:00
Fleny
895cc17106 Add voice state http endpoints (#3841) 2024-08-10 19:36:15 -05:00
Fleny
304a61c786 Add the propriety if it has _ to the object (#3828) 2024-08-07 01:20:50 -05:00
Fleny
9e1ada64b8 fix(rest): Use a _ check instead of the manual one on the switch (#3825)
* 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>
2024-08-03 10:17:26 +05:30
Fleny
791943a652 fix(rest): ignore snakelized properties in changeToDiscordFormat (#3795)
* fixes #3666

* Update packages/rest/src/manager.ts

Co-authored-by: Awesome Stickz <awesome@stickz.dev>

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-07-30 23:38:15 -05:00
Fleny
2421ae24cf Add application emoji endpoints (#3774) 2024-07-20 16:56:00 -05:00
Fleny
c1fd19c0ee Remove DiscordPartialGuild, use Partial<DiscordGuild> (#3768) 2024-07-20 16:55:45 -05:00
Fleny
0a5493196d fix(rest): Fix followups from getting stuck in queue (#3761)
* Fix followups from getting stuck in queue

* remove queueIdentifier as it isn't actually needed

* Revert some changes that aren't needed
2024-07-20 16:53:41 -05:00
Fleny
27fc12ec34 feat(cli)!: CLI generated types (#3453)
* 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>
2024-07-20 16:52:21 -05:00
Fleny
919474069d chore: Migrate ESLint and prettier to Biome (#3634)
* 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
2024-07-13 13:05:02 -05:00
Fleny
49ce2e44df feat(bot,rest,types): Add burst (super reaction) informations on events & DiscordReactionType (#3615)
* 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>
2024-07-07 10:26:35 -05:00
Fleny
b20e12ded4 feat(rest,types)!: User apps GA (#3696)
* User apps GA

* Apply code-review suggettions

Without some re-wording of the already confusing Discord usage of context/type term

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-07-07 20:42:02 +05:30
Fleny
5cccaeaf06 fix(rest)!: Fix Basic OAuth2 queues and add method for updating the queues and ratelimit paths after a refresh (#3185)
* fix basic auth requested

* Change queue keys to "{auth}{url}"

* add updateTokenQueues method

* Fix unit tests

* removed interval check for queue clear | needs testing

* hide tokens in debug logs

* Fix 429 & 401 requests, rename queueBaseKey to requestAuthorization

* fix unit tests

* Add proxy.updateBearerTokenEndpoint option

---------

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2024-07-06 17:30:03 +00:00
Fleny
c6ca749a4f Add botBannerURL to edit current bot banner (#3620) 2024-05-26 18:58:17 +00:00
Fleny
f8f976acf4 Add reason to followAnnouncement (#3622) 2024-05-26 18:51:00 +00:00
Fleny
47d0cea664 feat(bot,rest,types): Add support for one-time entitlements (#3626)
* Add support for one-time entitlements

* Add comment to consumeEntitlement route

Co-authored-by: LTS20050703 <lts20050703@gmail.com>

* Check for undefined instead of falsy values in consumed for entitlements

Co-authored-by: LTS20050703 <lts20050703@gmail.com>

---------

Co-authored-by: LTS20050703 <lts20050703@gmail.com>
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-05-26 18:38:48 +00:00
Kane Wang
d69e537ead fix getPollAnswerVoters return type (#3561) 2024-05-19 10:36:14 +00:00
Fleny
687c29dd7a feat(bot,rest,types,utils): Support User-Installed apps, Interaction contexts and install types (#3502)
* Support integrationTypesConfig in Application

* Add support for commands with integrationTypes and contexts

And deprecate the dmPermission boolean, it is being replaced by contexts

* Update contexts comment to make it more clear

* User-Installed apps

* Add integrationType oauth parameter

fixes #3517

* Add null to contexts

closes #3523

* Mark oauth2 install params as nullable

closes #3525

* Fix typescript errors

* Add preview notices

---------

Co-authored-by: Matt Hatcher <3768988+MatthewSH@users.noreply.github.com>
2024-04-29 15:36:29 +00:00
Fleny
6ad4e1d2e8 feat(bot,rest,types): Add polls support (#3542)
* Add polls support

* Add default for limit on GetPollAnswerVotes

* Apply code rewiew suggestion

Co-authored-by: LTS20050703 <lts20050703@gmail.com>

---------

Co-authored-by: LTS20050703 <lts20050703@gmail.com>
2024-04-28 11:42:19 +00:00
Fleny
75332eecda Add bulk ban (#3543) 2024-04-28 10:50:02 +00:00
Fleny
dfa1514577 Update comment for permissions needed when pruning members (#3503) 2024-04-18 09:24:43 +00:00
Fleny
efe56fbe06 feat(bot, rest, gateway, utils): Add support for custom loggers (#3383)
* Add support for custom loggers

* update docs for loggerFactory

* Use union for names in the bot logger factory

* Fix formaating errors
2024-03-17 11:22:45 +00:00
Fleny
2002a2bd6e feat(rest): Improve rest errors (#3382)
* Improve rest errors

* formatting
2024-03-08 04:42:49 +00:00
Fleny
edbb134efa docs: Update contributing docs (#3386)
* Update docusaurus typescript setup for v3

And fix lint-staged and eslint

* Enable automatic JSX runtime

* Remove babel config and dependencies

* update yarn.lock

* add typecheck to site workflow

* update typedoc config

* downgrade docusaurus packages

* Update site.yml

* Type context and options in webpack-docusaurus-plugin.ts

* Update contributing docs

remove howToUseTurborepo.md
update devcontainer
update task to remove error matcher
remove useless packages/rest/src/README.md
remove readme.hbs

* Add notice for the clean build

---------

Co-authored-by: Matt Hatcher <3768988+MatthewSH@users.noreply.github.com>
2024-03-08 04:40:27 +00:00
Dorian Oszczęda
05a20c3bf8 refactor(bot, gateway, rest)!: Improve the interface of the createBot() function. (#3422)
* misc: Make the token a required property on the rest manager.

* refactor: Make unnecessarily required properties optional.

* misc: Improve interface for `createBot()` and allow passing in `transformers`/`handlers`.

* fix: Test made redundant by changes still being included.

* fix: Missing non-null assertions.

* fix: Benchmarks failing.

* misc: Remove `cache.requestMembers.pending` as an exposed option.

* style: Switch back to interface approach.
2024-03-07 22:39:48 -06:00
Matt Hatcher
6b5d8094df fix(rest): remove has_message from forum route (#3384) 2024-02-25 01:40:09 +00:00
Fleny
f0ac958903 chore(website): Cleanup docusaurus setup (#3355)
* Update docusaurus typescript setup for v3

And fix lint-staged and eslint

* Enable automatic JSX runtime

* Remove babel config and dependencies

* update yarn.lock

* add typecheck to site workflow

* update typedoc config

* downgrade docusaurus packages

* Update site.yml

* Type context and options in webpack-docusaurus-plugin.ts

---------

Co-authored-by: Matt Hatcher <3768988+MatthewSH@users.noreply.github.com>
2024-02-09 20:34:59 +00:00
Fleny
5cb9b76e65 fix(rest): Add support for getGuilds with bot token (#3360)
* Add support for getGuilds with bot token

* Update manager.ts

* Fix prettier error
2024-02-09 18:45:27 +00:00
dependabot[bot]
e31c4d0a8a build(deps-dev): bump eslint-config-standard-with-typescript from 40.0.0 to 42.0.0 (#3297)
* build(deps-dev): bump eslint-config-standard-with-typescript

Bumps [eslint-config-standard-with-typescript](https://github.com/standard/eslint-config-standard-with-typescript) from 40.0.0 to 42.0.0.
- [Release notes](https://github.com/standard/eslint-config-standard-with-typescript/releases)
- [Changelog](https://github.com/standard/eslint-config-standard-with-typescript/blob/master/CHANGELOG.md)
- [Commits](https://github.com/standard/eslint-config-standard-with-typescript/compare/v40.0.0...v42.0.0)

---
updated-dependencies:
- dependency-name: eslint-config-standard-with-typescript
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Disable @typescript-eslint/no-unsafe-argument for the logger

* Fix eslint errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Fleny <Fleny113@outlook.com>
2023-12-11 22:04:40 +00:00
Fleny
0af084d932 feat: api docs catchup part 2 (#3266)
* add guild safety | closes #3020

* Adds approx guild count | closes #3078

* Team member permissions | closes #3105

According to current documentation DiscordTeamMemberRole#Owner does not have a value anymore, in this commit it still had so it is included to be changed by a later commit

* Default thread ratelimit | closes #3216

* Entitlements and SKUs | closes #3219

The entitlements events needs testing for the typing

* Typing endpoint docs update | closes #3222

* Add guildScheduledEventId to CreateStageInstance | closes #3228

* Add listSkus helper

I did forget it in the commit before

* Update Application Endpoints | closes #3230

* Update documentation | closes #3233

* fix starting a thread in forum | closes #3234 & closes #3036

* Add fired events on get widget endpoint | closes #3235

* Add fired events on get widget endpoint pt2 | closes #3236

* Update SKU and Entitlement fields | closes #3238

* Split permissions for expressions and events | closes #3249

* Make GetEntitlements#excludeEnded more specific | closes #3251

* Fix thread/forum channel docs regression | closes #3252

* Another description change for GetEntitlements#excludeEnded | closes #3253

* Document applied_tags on Execute Webhook | closes #3265

* Fix entitlement event types
2023-12-06 16:18:29 +00:00
Fleny
fb947f5672 feat(bot,rest,types): Add support for guild onboarding (#3260)
* Add types from api-docs-commit related to #2930

* Add rest from api-docs-commit related to #2930

* Add types from api-docs-commit related to #3072

* Add rest from api-docs-commit related to #3072

* Add types from api-docs-commit related to #3247

* Add transformers and helpers
2023-12-04 22:16:33 +00:00
Matthew Hatcher
e47242a9e0 feat: api docs catchup part 1 (#3257)
* feat: add voice message support

Closes #3009

* fix: pre-commit hook EACCESS npx issue

* feat: add channel to interaction

Closes #2979

* feat: add role flags

Closes #3070

* feat: adds creator monetization, message flagged, and member timeout audit log event

Closes #3075

* feat: add attachment flags

Closes #3071

* feat: add avatar decorations

Closes #3081

* feat: update description for guild and channel permissions

Closes #3106

* feat: rename Nitro sticker packs to just sticker packs

Closes #3107

* feat: add integration type to audit log entry

Closes #3108

* feat: make position optional on modify guild channel position

Closes #3086

* feat: add guild media channel type and associated flag

Closes #3093

* feat: update remark for activities.write scope

Closes  #3213

* feat: add support for super reactions

Closes #3113

* fix: attempt to fix benchmarks

* fix: benchmark attempt #2

---------

Co-authored-by: Fleny <Fleny113@outlook.com>
2023-12-04 21:54:39 +00:00
Skillz4Killz
59631f2fac format 2023-10-28 13:25:09 +00:00
Fleny
895b482a02 Add option for the header of auth on rest proxy (#3153) 2023-10-18 22:21:22 +00:00
Fleny
f98bb9bf75 fix(rest)!: Update OAuth2 to use the Basic authentication (#3150)
* update exchangeToken and revokeToken to use header

* update helpers file for the new signature
2023-10-15 04:32:04 +00:00
8au
f3a568c4db feat: rest header injection (#3122)
* feat: made some progress on a function which can be overridden to allow users to inject custom headers into a rest request

* made the changes suggested in PR. Renamed inject headers to createBaseHeaders, which adds the user agent into the headers.
2023-09-19 20:14:32 +00:00
Awesome Stickz
f34c0c3bc0 fix: bug with rest manager passing a timestamp instead of milliseconds in setTimeout (#3125) 2023-09-19 17:09:48 +00:00
Fleny
a7d645ec4b feat: Implement OAuth2 endpoints (#3114)
* add OAuth2 routes

* Add oauth2 methods to rest

* Add rest manager methods, Add token params

* Add authorization headers

* Add auth to editUserApplicationRoleConnection

* fix logging header always displaying bot as auth

* Add OAuth2Scope enum

* Start testing ratelimit handling

* Fix now scopes are separated by a space

* move webhook object to DiscordAccessTokenResponse

* convert payload to snake_case

* fix some typings

* more types fixes

* add support for upserting commands with tokens

* handle correctly ratelimit and concurrently

* add guild to DiscordAccessTokenResponse

* Add oauth2 create link function

* Fix removeTokenPrefix to support Bearer tokens

* update jsdoc comment for removeTokenPrefix

* fix removeTokenPrefix unit tests

* fix see link on getMember and getCurrentMember

* add bot helpers and fix some types

* Use objects to pass the bearer tokens

* fix Deno issue with Buffer.from

* Merge 'upstream/main' into feat/oauth2 to fix merge conflict

* Fix debug queue logging

* keep only 1 route for current user

* add Bearer prefixed url to the rest of the logs

---------

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2023-09-19 16:23:22 +00:00
Fleny
a087a52d6f Fix(rest) Fix error when serializing payload with a BigInt (#3117)
* Fix error when serializing payload with bigint

* add comment for reason of changeToDiscordFormat
2023-09-08 14:48:47 +00:00
Fleny
1e8edb99c6 bug(rest) Invert unauthorized check (#3104) 2023-08-24 17:21:17 +00:00
Skillz
db8c464081 fix: docs update Closes #3054 2023-08-20 11:16:17 -05:00
Awesome Stickz
0aeadbb275 fix(rest): bug with trying to pass string values in calculateBits() if object is already in Discord format in changeToDiscordFormat() (#3099) 2023-08-05 18:32:10 +00:00
Yaikava
ec5e800bcd 🐛 - fix: snakelize json when files are used (#3062) 2023-07-23 20:59:59 +00:00
NeKz
fe00a6f3e3 fix(rest): add missing files for editMessage (#3087)
* fix(rest): add missing files for editMessage

* fix(rest): extend attachment test with editMessage

* fix(types):  remove null from files type
2023-07-23 20:56:22 +00:00
Skillz4Killz
c9c510b0cd Merge branch 'main' of https://github.com/discordeno/discordeno 2023-06-06 16:28:56 +00:00
Skillz4Killz
73c9788065 feat(rest): easily enable or disable snake case 2023-06-06 16:28:50 +00:00
Skillz
5edfbb7efb fix: localization snake case bug 2023-05-08 13:21:51 -05:00
Skillz4Killz
1d232ac34a fix: interaction.edit type 2023-05-05 23:27:40 +00:00
Skillz4Killz
e54f51a7af fix: hack in helpers again (#3008)
* fix: hack in helpers again

* fix: remaining type errors

* fix: weird linter issue
2023-04-19 12:57:36 -05:00
Skillz4Killz
06f3c93790 fix: handle completed request marking behavior bug 2023-04-17 18:45:57 +00:00