Because Discord is so incompetent that they can't even handle 1s and 0s
in JSON, we can't really predict when they quote a number and when they
don't, because as it turns out, the documentation does not cover all
cases.
This commit adds a JSONUnmarshaler into OverwriteType to always trim the
quotes around then parse the number manually.
This commit removes the thread safety requirement that Conn
implementations must satisfy. It moves the mutex guards as well as the
multiple close wrapper over to the Websocket wrapper instead.
This commit adds automatic Intents detection into package bot. When the
Start function is used, the intents will be OR'd after running the
options callback.
This commit also breaks the old "AddIntent" methods to rename them to
"AddIntents" for correctness.
This commit updates Retry-After to be seconds-accurate instead of the
previous millisecond-accurate. Another issue (#153) is opened to get a
more accurate number, which is in the JSON body instead of the header.
This commit also removed the rate limit precision header. It also uses a
more accurate calculation algorithm to derive the reset time.
This commit changes the Overwrite type to omit the old "_new" API and
use the new field names, which are striings-serialized. The
OverwriteType is now also a strings-serialized number.
This commit fixes race conditions in both package voice, package
voicegateway and package gateway.
Originally, several race conditions exist when both the user's and the
pacemaker's goroutines both want to do several things to the websocket
connection. For example, the user's goroutine could be writing, and the
pacemaker's goroutine could trigger a reconnection. This is racey.
This issue is partially fixed by removing the pacer loop from package
heart and combining the ticker into the event (pacemaker) loop itself.
Technically, a race condition could still be triggered with care, but
the API itself never guaranteed any of those. As events are handled
using an internal loop into a channel, a race condition will not be
triggered just by handling events and writing to the websocket.
* API: fix faulty pagination behavior
This fix fixes a condition which lead to all messages getting fetched if the limit was a multiple of 100, instead of just the limit.
* API: add NewestMessages
* API: clarify MessageAfter docs
* API: adapt paginating methods for guild, member and message reaction to match the style of message's pagination methods
* API: return nil if no items were fetched
* API: remove Messages and Rename NewestMessages to Messages