Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selects component #954

Merged
merged 40 commits into from Aug 9, 2021
Merged

Conversation

FedorLap2006
Copy link
Collaborator

Well, during the development of the #933 I was also busy working on Selects component implementation. Now, since all API is experimental this request will be marked as draft one. Also this PR includes some fixes and improvements: like adding WebhookMessage endpoint and files support to webhooks API ( #951). Anyways, here it is: selects component. Feel free to give a feedback on this PR.

@FedorLap2006
Copy link
Collaborator Author

By the way, if you see a comment and commits related to buttons, don't be confused. Since I'm waiting for Carson's review, this changes isn't merged (but this PR is based on them). So, anyways, just don't mind this comment and commits.

@fletcherist
Copy link

@FedorLap2006 Great work! Thanks, I'm gonna try to test it

@FedorLap2006
Copy link
Collaborator Author

@FedorLap2006 Great work! Thanks, I'm gonna try to test it

Thanks. Now probably you're gonna be a little confused when you will be testing this. Because I forgot to document some moments. Probably in 30 minutes the docs will come.

@FedorLap2006
Copy link
Collaborator Author

@fletcherist So, now all docs should be in the place and you can test it if you have the beta access.

@fletcherist
Copy link

@FedorLap2006 I got this when I press button

[DG0] wsapi.go:585:onEvent() error unmarshalling INTERACTION_CREATE event, json: cannot unmarshal object into Go struct field Message.message.components of type discordgo.MessageComponent

@fletcherist
Copy link

I just created a message with button, and then clicked on it

@FedorLap2006
Copy link
Collaborator Author

The fixes is ready, try them out.

@fletcherist
Copy link

The fixes is ready, try them out.

thanks for quick response. trying!

@fletcherist
Copy link

fletcherist commented Jun 18, 2021

Now I've got an unmarshalling error, but event type is different

wsapi.go:585:onEvent() error unmarshalling MESSAGE_CREATE event, json: cannot unmarshal object into Go struct field MessageCreate.components of type discordgo.MessageComponent
panic: runtime error: invalid memory address or nil pointer dereference

@FedorLap2006 FedorLap2006 marked this pull request as ready for review June 22, 2021 17:57
@FedorLap2006
Copy link
Collaborator Author

I think API is final and we can start reviewing :)

@fletcherist
Copy link

fletcherist commented Jun 22, 2021

I tested that latest commit and got error I mentioned above 23a197a
#954 (comment)

@FedorLap2006
Copy link
Collaborator Author

Oh, yeah, forgot to push the commits.

@CarsonHoffman
Copy link
Collaborator

I think that the example here is getting a bit unwieldy, especially as Discord continues to add component types. It'd probably be best to have a more focused example dedicated to each type of component.

@FedorLap2006
Copy link
Collaborator Author

Huh. Sorry everyone for such long delay. Just was working on personal things. So, well, here it goes. Hope everything is done in scope of select menus, so I can move forward to other features.

FedorLap2006 and others added 11 commits July 30, 2021 19:49
* 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>
FedorLap2006 and others added 19 commits July 30, 2021 19:52
…ions with files (bwmarrin#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
@FedorLap2006
Copy link
Collaborator Author

Well, after some discussion with @CarsonHoffman we decided that I shouldn't let the branch be in the state it is and rebase it on the master branch of the repository. So, well, hope everything works. Enjoy!

interactions.go Outdated Show resolved Hide resolved
@CarsonHoffman CarsonHoffman merged commit 4ebe5a0 into bwmarrin:master Aug 9, 2021
jccit pushed a commit to jccit/discordgo that referenced this pull request Sep 14, 2021
* Interactions: the Buttons (bwmarrin#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 (bwmarrin#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>
@FedorLap2006 FedorLap2006 added this to the v0.24.0 milestone Feb 27, 2022
@FedorLap2006 FedorLap2006 added the feature Feature implementation label Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants