Commit Graph

71 Commits

Author SHA1 Message Date
Fleny
cf02481086 refactor(bot)!: setup desired properties for all transformers (#4435)
* 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
2026-01-28 10:13:35 +05:30
Fleny
27c261fee2 formatter: Use semicolons (#4686)
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.
2026-01-17 21:54:15 +01:00
Fleny
d8fc6ec02d feat(bot)!: make desiredProperties generic in transformers (#4469)
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>
2025-10-27 19:35:27 +01:00
Fleny
87d16dd9ba feat(types,bot): Add Label component and new modal stuff (#4304)
* feat(types,bot): Add Label component and new modal stuff

Since now there are some fields that are only in responses the types got a bit more complicated

* Add char limits to label label & desc

* update comments

* fix format

* Move Require to shared.ts

* code review

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2025-09-18 00:50:59 +05:30
Fleny
2a7cd9b2a5 refactor(transformers)!: Use type helper to define customizers (#4404)
* refactor(transformers)!: Use type helper to define customizers

This allows us to ensure that customizers always follow the correct types for the transformers and we don't have 2 places to add the types.

* remove outdated comment in transformInteractionDataResolved

* remove not needed cast

* remove not needed cast
2025-09-02 06:54:38 +02:00
Fleny
e94308c8f2 chore: Imports directly from files instead of index files (#4400)
Currently we import from `index.js` files where we could simply import the actual file(s) or module we need.

This also creates a bit of confusion since it isn't obvious from where stuff is coming from, especially when we are importing types such as `Discord<XYZ>` types both from `@discordeno/types` and a `index.js` in the same file, one such example is `transformers/reverse/component.ts`.

As far as I can tell, this does not have any specific advantage beside readability, maybe something with tree-shaking. (and for us, tree-shaking doesn't really matter)

The only files that still import index.js files are:
- index.js files themself
- bot/src/handlers.js since it does a `import * as handlers from './handlers/index.js'` and the alternative is like 90 lines of imports

Co-authored-by: Link <link20050703@gmail.com>
2025-08-26 20:41:14 +02:00
Fleny
b7db305dee refactor: Use TransformerFunction to define transformers (#4402)
Co-authored-by: Link <link20050703@gmail.com>
2025-08-26 10:56:43 -07:00
Fleny
c429ec9c36 feat(bot)!: Use an "extra" params for transformers (#4372)
Co-authored-by: Link <link20050703@gmail.com>
2025-08-20 12:10:35 -07:00
Link
8b41c9fe24 feat(bot,rest,types)!: Remove Discord JSON Params (#4351)
- Remove `createApplicationCommand` reverse transformer (Unused - `createGuildApplicationCommand` and `createGlobalApplicationCommand` use `snakelize`)
- Remove `DiscordModifyChannel`, `DiscordFollowAnnouncementChannel`, `DiscordCreateForumPostWithMessage`, `DiscordCreateGuildEmoji`, `DiscordModifyGuildEmoji`, `DiscordCreateGuildChannel`, `DiscordModifyGuildChannelPositions`, `DiscordCreateApplicationCommand`, `DiscordCreateMessage`, and `DiscordCreateWebhook` (unused)
- Remove `DiscordModifyGuildWelcomeScreen` (and replace it with `ModifyGuildWelcomeScreen`)

Fixes: https://github.com/discordeno/discordeno/issues/4308
2025-08-15 13:35:25 -04:00
Fleny
9de5d93014 feat(bot): Add guildId to ThreadMember (#4335) 2025-08-14 19:21:22 -07:00
Fleny
6679f2c0e4 chore(bot,utils): Move snowflake utils to @discordeno/utils (#4345) 2025-08-14 12:08:19 -07:00
Fleny
86f8fbd589 fix(bot)!: Remove InternalBot, add messagePin transformer (#4302) 2025-08-14 18:43:34 +02:00
Fleny
f199bbf71c build(dev-deps): Update biome to v2 (#4246)
* update biome to v2

* Run biome check --write

* Update biome.jsonc

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

* Fix config error

* Bump biome version

* Update website/yarn.lock

* Update biome to 2.1.3

---------

Co-authored-by: Link <lts20050703@gmail.com>
2025-08-09 12:45:04 -05:00
Fleny
612ac26ea7 feat(types,rest,bot): Updated message pin endpoints (#4228)
* feat: Updated message pin endpoints

* Apply suggestions from code review

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

---------

Co-authored-by: Link <lts20050703@gmail.com>
2025-07-12 09:30:35 +02:00
Fleny
cb8176c623 feat: user tags (#4238)
* feat: user tags

* Apply suggestions from code review

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

---------

Co-authored-by: Link <lts20050703@gmail.com>
2025-07-12 09:25:31 +02:00
Fleny
07a094e7e4 feat: role gradient colors (#4239)
* sort GuildFeatures

* feat: role gradient colors

* Use deprecated jsdoc tag

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2025-07-07 13:06:31 +05:30
Fleny
60c8d3e9ac Add customizers for colleactibles and nameplate (#4241)
They exited in the types but didn't in the runtime object causing a runtime error when the code needed to transform a nameplate

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2025-07-07 12:58:04 +05:30
Fleny
c4f2fc2b01 feat(types,bot): add user collectibles (#4225) 2025-06-14 13:38:58 +05:30
Fleny
3d90d816e7 feat(types,bot)!: Components V2 (#4080)
* UI

* change component names to match Discord's names

* add divider prop to separator component

* rename thumbnail component image property to media

* Rename MessageFlags.IsUiKit to IsComponentsV2

* Rename FileDisplay component to File component

* Added container component

* add id to container component transformers

* add id to all components

* SectionComponent.accessory now accepts ButtonComponent as well

* Update description for FileComponent.file

* fix bad merge

* Change Component.accessory to ButtonComponent | ThumbnailComponent

* Add section to reverse, fix Component#accessory

* remove type cast on section transform

* Add docs link for CreateGuildChannel

Co-authored-by: LTS (Link) <lts20050703@gmail.com>

* Update comments & split components

* fix type errors

* Really fix CI

* transform UnfurledMediaItem

* Apply suggestions from code review

Co-authored-by: LTS (Link) <lts20050703@gmail.com>

* change DiscordInputTextComponent to DiscordTextInputComponent

* fix order in Transformers.customizers

* Fix missing transformers

* update action row components type

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
Co-authored-by: LTS (Link) <lts20050703@gmail.com>
2025-04-26 08:35:06 +02:00
Fleny
22012fc288 feat(types, rest, bot): Add lobby support (#4158)
* 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
2025-04-25 21:15:42 +02:00
Awesome Stickz
4d3bdf233d feat!: add missing params to getThreadMember() and getThreadMembers() (#4135)
* 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>
2025-02-23 11:50:26 +01:00
Fleny
6b577c3f3d feat(bot,rest,types): Guild incidents data (#4123)
* Guild incidents data

* Update comments on ModifyGuildIncidentActions
2025-02-06 17:24:44 +01:00
Fleny
41219d5417 feat(bot): Remove some clutter from desired proprerties intellisense (#4050)
* 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>
2024-12-28 23:08:15 +05:30
Fleny
f40da4c1cf feat(bot)!: Add type helpers for type-level based desired props (#3954)
* 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
2024-11-17 08:37:41 -06:00
Fleny
cfdf77027a refactor(types,utils,rest,bot)!: Cleanup types & files (#3951)
* Cleanup some un-used & sort types, split files

* Remove commented code from reverse/component.ts

* Fix type error on the bot E2E test

* Add comment, remove DiscordInteractionResponse

* Remove camel.ts

* Error on unusedImport, refactor type imports

* Run biome check

* fix: typo

* Update comments for skuId and defaultValues

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-11-09 17:27:55 +01:00
Fleny
dfa7ff4045 feat(bot,rest,gateway,utils,types)!: Add soundboard support (#3919)
* Add soundboard support

* Add rest endpoints

* add comment to gateway requestSoundboardSounds

* Apply suggestions from code review

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

* Update for discord/discord-api-docs#7207

* Update discord.ts

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
Co-authored-by: ITOH <to@itoh.at>
2024-11-05 19:44:37 +05:30
Fleny
87e6cd0c2e feat(bot,rest,types): Add subscriptions (#3892)
* Add subscriptions

* Apply suggestions from code review

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

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-11-05 13:38:33 +01:00
Fleny
b1036b24cf feat(types,bot): Add banners to members (#3949)
* Add banners to members

* Fix comments on Member and DiscordMember
2024-11-05 13:17:45 +01:00
Fleny
d58de64704 Add command target to interaction response messages (#3959) 2024-11-05 13:16:41 +01:00
Fleny
b9200cfd39 Entry Point commands and Interactions updates (#3883) 2024-10-06 23:38:14 -05:00
Fleny
45bfa059b5 feat(bot,rest,types): Add get activity instance endpoint (#3891)
* Add get activity instance endpoint

* Add ActivityInstance & ActivityLocation transformers
2024-09-07 08:21:14 +02:00
Fleny
c1b0dc925d fix(bot)!: Remove direct calls to transformers (#3863)
* Remove direct calls to transformers

* Sort transformers by name

* Fix error
2024-08-18 09:04:18 +02:00
Fleny
895cc17106 Add voice state http endpoints (#3841) 2024-08-10 19:36:15 -05:00
Fleny
62b3122e89 Add recurrence rule to scheduled event (#3834) 2024-08-10 19:34:55 -05:00
Fleny
746f0a99ac fix(discordeno)!: Fix some errors in DiscordenoConfig (#3824)
* Fix typo, remove RecursivePartial from DiscordenoConfig.desiredProperties.properties

* Fix properties typo

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-08-03 10:26:21 +05:30
Fleny
c7b44e5e30 feat(bot): Add desiredProperties to createBot (#3787)
* Add `desiredProperties` to createBot

* remove not used default
2024-07-23 00:29:11 -05:00
Fleny
402f1b3049 Add message forward (#3764) 2024-07-21 11:49:07 -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
87f62d2a4b fix(bot,types): guild members flags (#3617)
* Add flags field to ModifyGuildMember

Also add the GuildMemberFlags enum as that was missing

* Add flags to member object

* Fix type error

* Update member transformer

* Readd flags desired propriety

* Rename enum to MemberFlag for consitency

* Rename to GuildMemberFlags, use number not the enum itself

* Use ToggleBitfield for flags

* Add getters

* Fix build error

* Merge flags in toggles

* change flags getter to return the actual flags

And not our custom toggles values

* Fix reverse transformer
2024-07-13 13:12:02 -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
7836ec393f Add missing proprieties on channel (#3736) 2024-07-13 08:52:05 -05:00
Fleny
727c7104ed Rename channel.autoArchiveDuration to defaultAutoArchiveDuration (#3741) 2024-07-13 08:19:26 -05:00
Fleny
2f89d4da30 Add partial guild to interaction (#3618)
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2024-07-07 16:32:06 -05:00
Fleny
24ea6f8af8 fix(bot)!: Guild features type (#3719)
* Fix guild features type, remove useless features des prop

* Add missing guild features
2024-07-07 16:14:13 -05:00
Fleny
9cea65f761 Add invite type (#3614) 2024-07-06 16:30:05 -05:00
Fleny
9cca689688 Add Attachment title (#3691) 2024-07-06 16:19:06 -05:00
Fleny
ad7e74c4cd feat(bot,types)!: Replace userId with User object in interactionMetadata (#3627)
* Replace userId with User object in interactionMetadata

* Fix type error

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-05-26 19:36:48 +00:00
Fleny
5290078044 fix(bot,types,utils)!: change avatar decoration url link (#3621)
* Change the avatarDecorationUrl link

* Add User#avatarDecorationData & Member#avatarDecorationData

* Fix type error

* Fix format error

---------

Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-05-26 19:14:11 +00:00
Fleny
163cebdcd0 Add the poll object to the message transformer (#3624)
Co-authored-by: Awesome Stickz <awesome@stickz.dev>
2024-05-26 18:49:05 +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