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.
* UserAvatar to accept user object.
One of the most important thing with this library is that it does 1 request per function. You have 100% control over how many web requests get made.
UserAvatar breaks that.
UserAvatar now accepts a user, which not only makes you know how many web requests gets made, but might also save on web requests if you have an existing user object.
* Removed dots. Please work, travis :<
* Ohhh... A friend spotted the error!
* `go fmt` and fixed comment... PLS TRAVIS
* Add support for relationships
Adds Support for:
- Sending friend request.
- Accepting friend request.
- Getting all the relationships.
- Getting all the mutual friends with another user.
- Blocking a user.
**Note:**
- Bot accounts are not allowed to access the endpoint.
- May closebwmarrin/discordgo#150
* Implement requested changes
Changed the uint8 declarations to int.
* Change the missed unint8 declaration to int
Missed one instance of unint8 during previous push.
* Add support for the prune endpoint
Adds functions to get the amount of members that could be pruned
and to prune members using the prune endpoint.
May close: bwmarrin/discordgo#147
* Deal with the go vet error
Removed the json tags from the unexported struct.
Should pass the tests now.
* Make the PR consistent with the rest of the file.
Removes url building in favour of string concatenation.
* Fix the previous commit
Adds back the result struct.
Converts the uint32 to string.
* Deal with golint comments
* Remove the failing test
Cleans up the uri concatenation.
Removes the failing test due to incorrect permissions.
* Added ratelimiter
Handles the new ratelimit headers
- X-RateLimit-Remaining
- X-RateLimit-Reset
- X-RateLimit-Global
* Pad only reset time with a second
* Moved ratelimiter out of internal package
* Change for loop, move global ratelimit check inside sleep check
* Moved ratelimiter locking to getBucket
* Added global bucket
* Changed how bucket id's are done
Now each request function will need to specify the bucket id if the
endpoint contains minor variables
* Allow empty bucketID in request
* Remove some uneeded Endpoint* function calls
* Added test for global ratelimits
* Fixed a silly little mistake causing incorrect ratelimits
* Update test comments, Fixed treating a endpoint as 2 in ratelimiting
* Use date header from discord instead of relying on sys time sync
* Update all REST functions to use RequestWithBucketID
* Embed mutex into bucket
* Added webhook and reaction buckets
Requires a channelID and a slice of messageIDs from the channel.
If only on ID is in the slice calls ChannelMessageDelete() internally.
If the slice of IDs is empty do nothing.
Renamed RateLimit struct to TooManyRequests{} and added new event struct
RateLimited{} which can be registerd to with AddHandler() and will be
emitted anytime a HTTP 429 is received on the HTTP API.