* 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 custom ratelimits
* check for nil ratelimiter
* Don't expose custom ratelimits to Session
* attempt to fix race conditions
* use defer instead
* Slightly improved ratelimiter
You shouldn't need to change the ratelimiters ratelimits while its
running so I removed the functions SetCustomRatelimit and
RemoveCustomRatelimit.
runtime.LockOSThread does not do anything for performance and is instead
intended for interfacing with libraries that use thread local data structures.
Closes#402
* Add heartbeat ACK response and error handling
- Error when sending a heartbeat now triggers a reconnection
- Op7 now triggers a reconnection
- Session now tracks the last heartbeat ACK that was recieved. If the
last ACK is more than FailedHeartbeatAcks*heartbeatinterval in the past,
this is treated as a dead connection and a reconnection is forced.
* Address @iopred comments
* ContentWithMentionReplaced on roles and nicks (Fixes#208)
* Compatibility
* Like this? 🤔
* More efficient regexp
* Tweaked a little
* Tweaked a little more
* Tweaked even more
* Removed unessecary crap condition that is useless
* Disallow voice channel
* Moved regexp declaration
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.