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
Interactions: the Buttons #933
Conversation
After some discussion about |
Hello everyone. It seems that documentation has been published and the buttons are ungated. I think It's time to mark this PR as ready for review. Well, enjoy the buttons! |
You can add the "Component" feature to these endpoints : https://discord.com/developers/docs/resources/webhook#edit-webhook-message They all support perfectly fine components objects and are needed to put buttons on a follow up message for example. |
My command router which just operates off of a MessageCreate handler breaks with this PR with the following trace:
|
@ChrisMcDearman Should be fixed now. |
Outside of a few outstanding small things, this is looking quite solid to me; the API surface is definitely cleaner than at the start. Not to jinx it, but as long as nothing else comes up in the near future, I'm excited to get this merged in! 🤠 |
I agree with @CarsonHoffman - this is pretty much it. But if anyone wanna give additional review/feedback, feel free to, at least until Carson will merge it 🤠 |
Oh, yeah, forgot about them! |
Thanks everyone for contribution and feedbacks. And special thanks @CarsonHoffman for his patience and reviews! 🚀 |
Thanks for this! Could we get some comments in https://github.com/bwmarrin/discordgo/blob/master/examples/components/main.go about how to use this / what it does? It's not immediately clear what this new interactions functionality is, or what we are supposed to see when running the example. After attempting it, I was met with:
Are there some prerequisite permissions that the bot needs? If so, a comment on adding them would be great. |
* 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>
* 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>
* 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>
* 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>
Hello everyone. Just finished implementing buttons functionality for DiscordGo. Looking forward a feedback.