Commit graph

29 commits

Author SHA1 Message Date
8e0346dc12
feat: Add UnMarshal 2025-05-14 21:25:27 +09:00
4ee5a8485c
fix: json tag 2025-05-14 21:23:03 +09:00
Fedor Lapshin
2a94d95411
feat: add components to unmarshalableMessageComponent.UnmarshalJSON 2025-05-05 13:33:13 +03:00
Fedor Lapshin
bdc047b3f9
feat: implement MarshalJSON 2025-05-05 13:28:28 +03:00
Fedor Lapshin
a1e4f3d201
docs: specify whether component is top-level 2025-05-05 12:05:06 +03:00
Fedor Lapshin
11ab346eaa
godoc fix 2025-04-26 14:20:20 +03:00
Fedor Lapshin
5fd20bb8c2
feat: add docs 2025-04-26 14:17:10 +03:00
Fedor Lapshin
9600402fc1
feat: components v2 structures 2025-04-26 14:05:02 +03:00
Fedor Lapshin
49980810d5
fix id type and add messageflags prefix to IS_COMPONENTS_V2 flag 2025-03-07 22:19:45 +03:00
Fedor Lapshin
e0f5cdab0a
feat(components): add more types and id field 2025-03-07 22:09:04 +03:00
Jonas
33ffff21d3
Add Entitlements / SKUs (#1552)
Pull Request: https://github.com/bwmarrin/discordgo/pull/1552

Copied Message from Commits:

* add entitlement struct

* add entitlements field to interaction struct

* add event handler for entitlements

* add description to Entitlement struct & type

* properly format changes in entitlement and events

* format entitlement with gofmt

* move entitlement to structs

* add subscription id to entitlement struct and add omitempty

* add endpoints

* add comments to EntitlementTest and EntitlementOwnerType

* add sku struct

* add skus

* fix typo

* rename skuid in entitlement struct

* add comments to SKUFlags

* change entitlement timestamps to time.Time

* rename skuid in entitlement-test struct

* add documentation

* remove undocumented subscriptionID field in entitlement struct

* add documentation

* update documentation

* change order of EntitlementType values

* move optional entitlement filter options into a separate struct

* add premium button component

* add subscriptions

* optimize optional fields in entitlement struct

* Add documentation

* typo

* remove unneccessary pointers
2024-12-08 17:16:00 +10:00
Paul Hamill
afc57886f9
fix(SelectMenuOption)!: omit empty emoji field (#1476) 2024-01-04 22:11:17 +03:00
Joshua Packard
f70a01544f
fix(buttons)!: omit empty emoji field (#1475) 2024-01-04 07:17:34 +03:00
Fedor Lapshin
f7800efc52
docs(SelectMenu): correct a typo 2023-12-08 15:51:10 +03:00
Fedor Lapshin
0068a2db3c
feat(SelectMenu): default values (#1452)
* feat(SelectMenu): default values

* fix: remove unncessary pointer

Since SelectMenu is used as a nested structure, it is not possible to
partially edit it. Thus, an empty slice does not need to be accounted for,
and the pointer, which would only be omitted if the value is nil, can be
converted to a regular slice.

* fix: correct grammar in the comment to SelectMenuDefaultValueType
2023-12-08 15:47:42 +03:00
Fedor Lapshin
b8188269f9
Auto populated select menus (#1269)
* feat(components): auto-populated selects

* Add component types for user, channel, role and mentionable selects
* Add MenuType field to SelectMenu for customization of select type
* Add basic example for auto-populated selects

* feat: implement SelectMenuType to restrict component types

Implement SelectMenuType to restrict component types that can be used
in MenuType field of SelectMenu structure.

* fix(SelectMenu): default type

Default to SelectMenuComponent type when MenuType is not specified.

* feat(examples/components): add ephemeral

Add ephemeral flag into response to match other component examples.

* feat(examples): option response and refactoring

* Add a response to the selected option.
* Refactor the command to match others.
* Remove showcase of multiple menu types.
2022-12-03 01:40:30 +03:00
Fedor Lapshin
eda859edc9
feat: custom JSON marshal/unmarshal functions (#1162) 2022-04-17 21:39:18 +03:00
fiatjaf
9586f7fb38
Remove omitempty for Embeds (#1106)
* do not omit empty .Embeds so we can clear embeds when editing.

* also do not omitempty for required: false in text inputs.
2022-03-07 15:51:03 +03:00
Fedor Lapshin
a4d694738f
feat: min and max constraints for slash command options (#1026)
* feat: min and max constraints for slash command options

* fix: typo

* feat: changed slash command options min-max values to float

* feat: improved min max constraints

* feat: removed helper functions

* fix(examples): helper functions

* feat(components): made MaxValues int in SelectMenu

* fix(examples/components): MaxValues

* feat(interactions#ApplicationCommandOption): removed pointer from MaxValue

* feat(examples): removed helper functions for MinValue and MinValues

* fix(examples): removed newOptionalInt
2022-02-26 21:02:33 +03:00
Reed Trevelyan
0b48d46eef
add disable prop to selectMenu (#1102) 2022-02-22 00:14:47 +03:00
nitroflap
0494cdf33c
feat(components): added comment to MessageComponentFromJSON 2022-02-16 16:50:33 +03:00
nitroflap
e6b33f37b7
fix(components): renamed TextInputStyleType to TextInputStyle and fixed example 2022-02-09 14:12:31 +03:00
Fedor Lapshin
21ba398898
feat(components): add omitempty and use TextInputStyle
Co-authored-by: ToπSenpai <15636011+TopiSenpai@users.noreply.github.com>
2022-02-09 14:07:36 +03:00
Fedor Lapshin
147703db8e
feat(components): renamed TextStyleType to TextInputStyleType 2022-02-09 03:58:16 +03:00
nitroflap
a0095c14ed
chore(components): rename InputText to TextInput 2022-02-09 03:39:28 +03:00
nitroflap
09e3d894b7
feat: modal interactions and text input component 2021-12-09 04:03:43 +03:00
Carson Hoffman
55f4934ba7
Add MessageComponentFromJSON 2021-12-02 15:07:38 -05:00
Fedor Lapshin
4ebe5a08ee
Selects component (#954)
* Interactions: the Buttons (#933)

* Interactions: buttons

* Doc fix

* Gofmt fix

* Fix typo

* Remaking interaction data into interface

* Godoc fix

* Gofmt fix

* Godoc fix

* InteractionData helper functions and some fixes in slash commands example

* Fix components example

* Yet another fix of components example

* Fix interaction unmarshaling

* Gofmt fix

* Godoc fix

* Gofmt fix

* Corrected naming and docs

* Rolled back API version

* Requested fixes

* Added support of components to webhook and regular messages

* Fix components unmarshaling

* Godoc fix

* Requested fixes

* Fixed unmarshaling issues

* Components example: cleanup

* Added components tracking to state

* Requested fixes

* Renaming fix

* Remove more named returns

* Minor English fixes

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>

* Doc fix

* Gofmt fix

* Fix typo

* Remaking interaction data into interface

* Godoc fix

* Gofmt fix

* Godoc fix

* InteractionData helper functions and some fixes in slash commands example

* Fix components example

* Yet another fix of components example

* Fix interaction unmarshaling

* Godoc fix

* Gofmt fix

* Corrected naming and docs

* Rolled back API version

* Requested fixes

* Added support of components to webhook and regular messages

* Interactions: select menus

* Example fix

* Merge fix

* Some fixes

* Added missing documentation

* Fix components unmarshaling

* Godoc fix

* Requested fixes

* Fixed unmarshaling issues

* Components example: cleanup

* Gofmt fix

* Godoc fix

* URL field renaming fix

* Added flags to followups

* Updated components example

* Fixed typo in components example

* Merge fix

* Improve handling of invalid interaction situations

* support allowing webhook edits with files, and responding to interactions with files (#931)

* allow files in webhook message edits

* add Files to WebhookEdit struct

* move the construction of the multipart body for files into a shared function

* allow  interaction responses to have files

* go fmt

* fix err shadowing

* document MakeFilesBody

* rename MakeFilesBody -> EncodeWithFiles. fix InteractionRespond responding twice

* use resp in InteractionRespond files, add basic-command-with-files example command

* import strings and go fmt

* EncodeWithFiles -> MultiPartBodyWithJSON

* go fmt

* fix example for slash_commands

* move files to responsedata

* Merge fixes

* Fixed rebase consequences

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
Co-authored-by: plally <pierce@vulpes.dev>
2021-08-08 20:16:07 -04:00
Fedor Lapshin
421e149650
Interactions: the Buttons (#933)
* Interactions: buttons

* Doc fix

* Gofmt fix

* Fix typo

* Remaking interaction data into interface

* Godoc fix

* Gofmt fix

* Godoc fix

* InteractionData helper functions and some fixes in slash commands example

* Fix components example

* Yet another fix of components example

* Fix interaction unmarshaling

* Gofmt fix

* Godoc fix

* Gofmt fix

* Corrected naming and docs

* Rolled back API version

* Requested fixes

* Added support of components to webhook and regular messages

* Fix components unmarshaling

* Godoc fix

* Requested fixes

* Fixed unmarshaling issues

* Components example: cleanup

* Added components tracking to state

* Requested fixes

* Renaming fix

* Remove more named returns

* Minor English fixes

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
2021-06-27 12:16:52 -04:00