Commit graph

45 commits

Author SHA1 Message Date
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
Yusta
02e7ea559b
feat(interactions): add GetOption method to interaction data structs (#1535)
* Add ApplicationCommandInteractionData.GetOption
* Add ApplicationCommandInteractionDataOption.GetOption

---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2024-10-06 19:47:26 +03:00
Fedor Lapshin
d26ad10ba6
feat: implement polls (#1525)
* feat: add poll events

* feat: add poll structs

* feat(MessageSend): add poll field

* feat(InteractionResponseData): add poll field

* feat: add endpoints
2024-06-21 10:37:32 +03:00
Fedor Lapshin
a31fd8617e
feat: user apps (#1511)
* feat: add integration types

* feat(ApplicationCommand): add integration_types

* feat(interactions): implement contexts

* feat(Interaction): add authorizing_integration_owners

* chore(ApplicationCommand): deprecate DMPermission

* feat(Application): add integration_types_config

* feat(Message): add InteractionMetadata

* feat(ApplicationIntegrationTypeConfig): add omitempty tag to OAuth2InstallParams

* feat(Application): add omitempty tag to IntegrationTypesConfig
2024-06-20 17:56:18 +03:00
Koke_Cacao
b3638db82a
feat(interactions): implement Attachments field (#1392)
---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2023-12-30 07:24:00 +03:00
Victor Souza
7ec67b07d2
Add CommandType field to ApplicationCommandInteractionData (#1362)
* Add the CommandType field to ApplicationCommandInteractionData

* Remove unnecessary comment

* Change order of the fields

---------

Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
2023-04-15 02:31:36 +03:00
ikafly144
0a42ffa9da
Add nsfw option (#1310) 2023-01-14 23:42:05 +03:00
ikafly144
4074561d23
Add MessageComponentInteractionDataResolved struct (#1302) 2022-12-23 23:41:48 +03:00
Nils Ponsard
bd58eb717e
fix(interactions): incorrect call of State.Role in RoleValue (#1237)
The gID parameter was passed to State.Role as roleID
and roleID was passed as guildID.
This commits inverts the arguments order to fix the issue.
2022-10-07 14:21:30 +03:00
Fedor Lapshin
0feaae8f1b
feat(ApplicationCommandOption): min and max length (#1208)
Implement min_length and max_length for string option type.
2022-07-15 00:40:21 +03:00
Fedor Lapshin
f697ccae8c
feat(ApplicationCommand): guild id (#1207)
Add missing guild_id field to ApplicationCommand structure
2022-07-02 23:27:27 +03:00
Fedor Lapshin
033c07d89d
feat(interactions): application permissions (#1206) 2022-07-02 23:24:07 +03:00
Andres Perez
d7b4a482b5
Use MessageFlags in InteractionResponseData and WebhookParams (#1178) 2022-05-23 01:14:28 +03:00
Fedor Lapshin
9e0783c37f
Application commands: Permissions v2 (#1075)
* feat(interactions): default command permissions

* feat: add ApplicationCommandPermissionTypeChannel

* feat: add deprecation and oauth2 scope comments

* feat(interactions): add GuildAllChannelsID function

* feat(examples/slash_commands): application command permissions

* feat(events): add ApplicationCommandPermissionsUpdate

* feat: add AuditLogActionApplicationCommandPermissionUpdate

* feat(interactions#GuildAllChannelsID): use strconv instead of math/big

* feat(interactions#GuildAllChannelsID): error handling

* feat: cosmetic changes

* fix(examples/slash_commands): handle error returned by GuildAllChannelsID

* fix: typo

* fix: typo
2022-04-29 00:23:07 +03:00
ToπSenpai
4d72c306b4
Add ApplicationID field to Interaction (#1125)
* add application_id to interaction struct and remove appID param from rest routes

* revert voice receive go mod & sum
2022-04-14 22:07:53 +03:00
Fedor Lapshin
9356a844d9
Application commands localization (#1143)
* feat(interactions): application commands localization

* feat(interactions): add missing omitempty to localization fields

Co-authored-by: ToπSenpai <15636011+TopiSenpai@users.noreply.github.com>

Co-authored-by: ToπSenpai <15636011+TopiSenpai@users.noreply.github.com>
2022-03-31 22:26:23 +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
nitroflap
11283ba0ab
feat(interactions): number application command option 2022-03-02 22:05:22 +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
Bjorn Zandvliet
d5bacb5401
Add Default Permission to #943 (#1071)
* Create edit application command permissions endpoint

* Add remaining command permissions endpoints

* Clean up naming a bit

* Add docs for application command permissions endpoints

* Update comments

* More comments

* :^)

* Put the verb in API method names at the end

* Review feedback

* Add default permissions

* feat(restapi): rewording of comments to application command permissions endpoints

* fix(rest): errors for application commands permissions endpoints

* style(interactions): changed order of fields in ApplicationCommand

Co-authored-by: NotUnlikeTheWaves <hleistra@gmail.com>
Co-authored-by: nitroflap <fe.lap.prog@gmail.com>
2022-02-16 22:17:26 +03:00
Fedor Lapshin
0a0955c5f9
Application commands: attachment option (#1088)
* feat(interactions): application command attachment option

* fix(interactions): corrected application command attachment option type
2022-02-16 21:02:44 +03:00
Fedor Lapshin
82c5aae791
Merge pull request #1049 from FedorLap2006/modals
Modals
2022-02-16 02:18:39 +03:00
nitroflap
a731868627
fix(interactions): unnecessary newline between field and comment 2022-02-16 02:16:44 +03:00
nitroflap
195a4c4418
fix(interactions): typo in comment to ModalSubmitData 2022-02-16 02:15:16 +03:00
nitroflap
e44c83a1fc
feat(interactions): added note about modals to InteractionResponse 2022-02-16 02:13:29 +03:00
ToπSenpai
4620fe3034
add interaction locales (#1073)
* add interaction locales

* Typos

* Fix locales documentation link

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
2022-02-02 14:45:15 -05:00
Carson Hoffman
7c455ffc70
Allow marshaling of data field in interactions 2021-12-27 21:34:15 -05:00
nitroflap
09e3d894b7
feat: modal interactions and text input component 2021-12-09 04:03:43 +03:00
Fedor Lapshin
fd6228c0d5
Slash commands options auto completion (#1014)
* feat(interactions): options autocompletion

* fix(examples/autocomplete): typo in comment

Replaced "returining" with "returning"
2021-11-16 22:56:33 -05:00
Han Seung Min - 한승민
9f89234f3f
Update invalid link to docs (#1010) 2021-10-10 11:02:24 -04:00
Fedor Lapshin
4249df2359
Channel type restriction (#1015) 2021-10-10 10:59:59 -04:00
Fedor Lapshin
9d9602318a
Context menus (#978)
* Interactions: context menus

* Example for message context menus

* Added flags to followups

* Example for user context menus

* Godoc fix

* Rebase fix

* Update message types to reflect new separations

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
2021-08-18 16:16:46 -04: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
plally
ab47f123ba
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
2021-07-30 11:22:08 -04:00
Carson Hoffman
083bf5c1d9
Improve handling of invalid interaction situations 2021-07-25 13:39:31 -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
Carson Hoffman
f5bb723db8
Convert more constants to absolute values
See 843c765ae3 for reasoning.
2021-05-29 17:55:43 -04:00
Pierce
ccf3b3738e
add ApplicationCommandInteractionDataResolved struct (#919)
* add ApplicationCommandInteractionDataResolved struct

* add comment to ApplicationCommandInteractionDataResolved

* change wording of comment for ApplicationCommandInteractionDataResolved
2021-05-25 22:06:38 -04:00
Pierce
ec2cf69202
Remove deprecated response types (#930)
* update deprecated notices

* remove deprecated response types

* remove InteractionResponseChannelMessage usage

* remove deprecated response types from example options

* stop using iota for respone type constants
2021-05-14 22:18:50 -04:00
Pierce
7d7206b01b
Bulk command overwrite (#926)
* add session.ApplicationCommandBulkOverwrite

* change ApplicationCommandBulkOverwrite to take a guildID

* formatting

* add omitempty to ID of ApplicationCommand
2021-05-11 23:51:33 -04:00
Pierce
cbae312c9d
add ApplicationCommandOptionMentionable (#918) 2021-05-10 17:01:10 -04:00
courtier
3fcad20924 Fix all the typos that goreportcard detected. 2021-05-06 01:06:45 +02:00
Carson Hoffman
ba10a00fbc
Add User to Interaction 2021-03-12 09:45:35 -05:00
Fedor Lapshin
b0fa920925
Slash commands (#856)
* UnknownBan error code addition

* GuildBan method implementation

* Gofmt fix

Gofmt fix

* Interactions: application commands basic API and gateway integration

* Some gitignore update

* Application commands and interactions API implementation

* Some fixes

* Some improvements of slash-commands example and slash-commands API

* OAuth2 endpoints backward compatibility

* Gofmt fix

* Requested fixes and documentation improvement for application commands

* Some fixes

* New and more interesting example of slash-commands usage, merging "interaction.go" and "interactions.go" into a single file. And some fixes.

* Gofmt and documentation fixes

* More fixes

* Gofmt fixes

* More fixes!

* Doc and endpoint fixes

* Gofmt fix

* Remove dependence on open gateway connection

* Remove redundant command ID checks

* Fix typo in ApplicationCommandCreate comment

* Tidy up function calls returning body

* Add upcoming API changes

* Correct return value name, swap parameter order

* Add Version field to ApplicationCommand

* Fix up language in comments

* Remove redundant conversion to float64

Co-authored-by: Carson Hoffman <c@rsonhoffman.com>
2021-02-28 21:54:02 -05:00
Jon Chen
dc3c2d5533 implement interaction request signing verification 2021-01-13 17:43:43 +00:00