This commit gets rid of contain-it-all structs and instead opt for
interface union types containing underlying concrete types with no
overloading.
The code is much more verbose by doing this, but the API is much nicer
to use. The only disadvantage in that regard is the interface assertion
being too verbose and risky for users at times.
* api: Adapt Client.EditMessage, SendEmbedReply, and SendMessageReply to take in
multiple embeds
* api: Fix incorrect use of Client.EditMessage
* api: Make EditMessage omit empty content or embeds from payload
SendMessage(a, b) is equivalent to SendText(a, b) so SendText is
redundant.
Programs using SendText can be updated with
$ gofmt -r 'c.SendText(a, b) -> c.SendMessage(a, b)' -w .
api.{Send,Edit}MessageData and their equivalents in package api/webhook
have been updated to add some fields added in Discord API v9.
(webhook.Client).EditMessage now also returns a message, because that
endpoint returns a message on success.
* Gateway: Fix gateway reconnect
This commit uses the correct timeout, Gateway.ReconnectTimeout, when reconnecting. Furthermore, it adds a delay between consecutive, failed reconnects.
* Gateway: Stop pacemaker when calling Gateway.CloseGracefully
* API: remove unnecessary leading/trailing whitespaces
* Gateway: Add Gateway.OnScalingRequired callback
* Gateway: Make all user initiated user closures graceful and ensure that closures are respected during reconnects
* Gateway: Fix typo
* Gateway: Add Gateway.ReconnectAttempts and deprecate .ReconnectTimeout
* Gateway: Add Gateway.Pause and reexport .Reconnect and .ReconnectCtx
* Gateway: Improve the Gateway.OnShardingRequired docs
* Wsutil: Code cleanup
remove boundary limits for DeleteMessages
rename deleteMessages to deleteMessagesRaw
use constant instead of limit literal
add min helper func
rename utils.go to math.go
* 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