* 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>
* 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
* add session.ApplicationCommandBulkOverwrite
* change ApplicationCommandBulkOverwrite to take a guildID
* formatting
* add omitempty to ID of ApplicationCommand
* 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>
Endpoint support added:
- @/channels/:id/messages/:id/crosspost - publishes a message in a news
channel to followers
- @/channels/:id/followers - follows a news channel
This function currently has an issue where it sends too much data, causing Discord to reject the request as it believes you're trying to amend several fields by sending all of them.
This change resolves that by creating a simplified version of the Channel struct that only sends the data required for reordering.
* Added UserConnections function and structs
* Rename Connection to UserConnection
* Embed Integrations inside GuildIntegration and remove GuildIntegrationAccount
* Replaced GuildIntegration with Integration
* Fix#406: reconnect() can be called while still connected
* Add memberMap to speed up member queries
* Fix error return value and remove deletion
* Fix GuildAdd member map initialization edge case
* Add rate limit buffering support
- Break request into requestInner
- Break LockBucket into LockBucketObject
- Change getBucket to GetBucket so it can be externally accessed
- Add RequestBuffer interface
- Add RequestBuffer pointer to Bucket struct
- Add RequestPostWithBuffer() function to Session
* Remove internal implementation, export ratelimiter instead
Reference Issue: https://github.com/bwmarrin/discordgo/issues/440
This endpoint was declard twice in endpoints.go, and used in the
GuildInvites() method on Session values. I replaced the misspelled
invocation.
All tests pass.
For compatibility with existing library consumers, the File field is retained but will behave as if Files contained that single file. If both are specified, ChannelMessageSendComplex will return an error.
The message JSON payload is moved to a form-data field called `payload_json`, instead of set in multipart form data. This is supported and the recommended way, as per the API docs.
Apparently, you can attach multiple files if you just name the parts names differently in the multipart request. The parts are named here using the order the files were specified, as `file%d`. This is not documented in the API docs, but definitely works.
This also removes serialization of the File field via json.Marshal, as it will never be directly serialized in the JSON. The new field, Files, is similarly not marshaled.
This additionally adds a ContentType field in File, which can be used to specify the content type of the attached file. The ContentType field will default to setting the header to `application/octet-stream` if empty. Discord currently doesn't do much with the Content-Type header, but we should pass this information along anyway in accordance to the MIME standard.