Commit Graph

162 Commits

Author SHA1 Message Date
starshines f7880b91ee
discord: Add select component type (#260) 2021-08-10 14:02:30 -07:00
Maximilian von Lindern c00567599b
api: Threads (#257)
* api/gateway: Implement threads

* discord/api: rename PermissionOverwrites fields to Overwrites

* discord: rename Minutes to ArchiveDuration

* discord: Rename ArchiveDuration constants

Co-authored-by: diamondburned <datutbrus@gmail.com>
2021-08-08 13:19:15 -07:00
Hamza Ali 0d7774bd6a
gateway: Skip unknown events while reconnecting (#255)
This change skips events that are unknown while the bot reconnects. This
is an event that is particularly rare as it requires unimplemented
events being called in the time before a bot's HELLO -> RESUME events
are called. This change explicitly returns unknown events as a special
time defined in wsutil/op.go and ignores them from reaching gateway/op.go
2021-08-03 18:00:31 -07:00
Starshine System 42aa73a592 gateway: change InteractionOption.Value to json.Raw, add helper methods 2021-08-03 09:07:09 -07:00
diamondburned 6c349d9750 shard: Unwrap Shard in ForEach 2021-06-24 21:20:58 -07:00
Germano Eichenberg 94090b92ff
discord, gateway: Add IsPending to Member & SupplementalMember (#231) 2021-06-17 13:40:57 -07:00
diamondburned da7c6c6dba gateway: Allow custom SessionID 2021-06-14 15:23:08 -07:00
diamondburned 5b328bdab0 shard: Remake shard manager (#226) 2021-06-14 15:22:55 -07:00
Samuel Hernandez 40e1a3757d *: Migrated Go Modules to v3 2021-06-01 19:59:01 -07:00
Maximilian von Lindern df5954d2e1
all: Revert incorrect "GuildID" changes (#211) 2021-05-30 14:16:16 -07:00
Maximilian von Lindern 6c2fb008eb gateway: Rename RequestGuildMembersData.GuildID to GuildIDs for consistency 2021-05-29 22:17:55 -07:00
Maximilian von Lindern d2b70ebfa7 all: Remove deprecated symbols 2021-05-29 22:17:44 -07:00
diamondburned 694d6a2bba gateway: Clarify field presence for InteractionCreateEvent 2021-05-29 21:32:35 -07:00
Scott 10c8837000 api: Finalized buttons implementation (#200)
* all: Added Components fields to message-related types
* discord: Documented Reactions field
* discord: Implement fix for Component
* gateway: Added User and Message fields to InteractionCreateEvent
* api: Made InteractionResponseData fields optional for UpdateMessage responses
* api: Deprecated and updated interaction response types
* gateway: Update optional interaction event fields
* discord: Added ComponentWrap for json unmarshalling
* state: Update components on MessageUpdate
* Updated buttons example
2021-05-29 21:32:33 -07:00
Chan Wen Xu c880cb2fc8 interaction: Implement buttons 2021-05-29 14:16:44 -07:00
Starshine System 20166f33cc
gateway: fix Joined field in GuildCreateEvent (#193) 2021-04-11 16:56:05 -07:00
diamondburned 728bc5c472 Gateway: Test Reconnect error 2021-04-07 11:42:13 -07:00
Maximilian von Lindern ebc74e3168
Gateway: Sharding callback, proper closing (#190)
* 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
2021-04-07 11:38:26 -07:00
diamondburned 9925461a25 Gateway: Potential fix for URL() 2021-04-05 12:20:56 -07:00
diamondburned c9a7ec8122 Gateway: Add URL test 2021-04-05 12:20:56 -07:00
diamondburned 2dadb0701d Gateway: Add automatic BotData connection
This commit modifies Gateway constructors to allow the user to easily
feed existing Identifier instances as well as updating those instances
to adhere to the Discord-returned gateway rate limits.

These changes should make it easier for typical bot sharding, although
automatic sharding is not implemented.
2021-04-05 12:20:56 -07:00
diamondburned 968112fb53 Discord: typed snowflake for Interaction 2021-02-17 17:41:19 -08:00
diamondburned 5a18435190 Gateway: Better Activities type for UpdateStatusData
This is a breaking change.
2021-02-07 17:03:12 -08:00
Maximilian von Lindern a969b11709
Gateway: Add graceful closing with CloseGracefully (#185)
* gateway: add the possibility of graceful closure

* wsutil: rename ConnGracefulCloser to GracefulCloser

* Gateway: rename Gateway.CloseSession to .CloseGracefully
2021-01-29 20:25:10 -08:00
Matthew Penner 7c3374543e Discord: Add basic support for slash commands 2021-01-27 10:44:14 -08:00
diamondburned 169b361262 Gateway: Add Threads into GuildSubscribe 2021-01-01 00:33:35 -08:00
diamondburned c6d8c741e8 CI: Add perseverance test for Gateway 2020-12-31 23:48:29 -08:00
diamondburned 7b67a98405 Gateway: Prevent heartbeat reconnecting twice 2020-12-31 23:01:38 -08:00
diamondburned f1f052180b Heart: Improve thread-safety and pace responsiveness
This commit consists of these smaller commits:

    Gateway: SessionID to be a method for thread safety

	This commit breaks the SessionID field of the Gateway struct to
	be thread-safe by wrapping its access with a read-write mutex.
	As this is a bug fix, it is reasonable of a breaking change

    Heart: Allow later binding of event channel

    Voice: Use the new Heart API

    Heart: Fixed data races

    Heart: Allow changing pace, thread-safe Heartbeat
2020-12-31 01:32:45 -08:00
diamondburned 05de2d7b61 Gateway: Made Shard field empty for default 2020-12-30 23:43:08 -08:00
diamondburned 088b304303 Gateway: Rename MessageNotifications to Notifications for consistency 2020-12-19 19:22:35 -08:00
diamondburned d5f3979f95 Gateway: Rename UserGuildMute to UserMuteConfig for correctness 2020-12-19 19:06:09 -08:00
diamondburned 7aff3f9f24 Gateway: Added MuteConfig into UserChannelOverride 2020-12-19 18:59:15 -08:00
diamondburned 4e62f120a2 Gateway: Readd Presences into Ready 2020-12-19 18:46:21 -08:00
diamondburned f11edb7260 State: Add Ready Supplement handlers 2020-12-18 22:51:26 -08:00
mavolin 9911a3d662 State: fix caching not working properly on user accounts 2020-12-08 11:50:35 -08:00
diamondburned 5e2af90fd0 Gateway: Rollback weird user changes 2020-12-01 18:07:42 -08:00
diamondburned b8994ed0da Voice: Remove state-keeping of sessions
This commit gets rid of all the code that previously managed different
voice sessions in different guilds. This is because there is rarely ever
a need for this, and most bots that need this could do their own
keeping.

This change, although removes some features off of the package, adds a
lot of clarity on what to do exactly when it comes to connecting to a
voice channel.

In order to make the migration process a bit easier, an example has been
added which guides through using the voice.Session API.
2020-11-30 19:12:20 -08:00
diamondburned c6679dc52c State: Separate Store into smaller interfaces, Cabinet API
This commit refactors the Store interface in State into smaller
interfaces in package store. These interfaces are combined into one
structure called a "Cabinet". The default implementation of those
interfaces have been rewritten in package defaultstore, while the old
no-op implementation stays with the store package.

This commit also omitted several state handlers for user events, as it
is unclear what they are actually structured like.
2020-11-29 16:57:58 -08:00
diamondburned a2333996a2 Gateway: Presence to contain user and guild fields
This commit changes the gateway.Presence struct to be similar to commits
prior to the last refactor, that is, the struct would have the User and
GuildID fields. This is done so it's easier to store them.
2020-11-28 22:36:33 -08:00
diamondburned 6ef093eb98 Gateway: Refactor, v8 user struct updates
This commit refactored several structures from package discord to be in
package gateway. Those structures are mostly presence ones, which per
official documentation has a lot more to do with the Gateway API than
the REST API or anything else.

This commit also renamed several global variables to have a more
consistent and obvious name.

As of v8, the user API has had a lot of minor and some major changes,
especially regarding its Ready event API. The most significant change is
the addition of the ReadySupplemental event as well as several changes
to the Ready field itself.

All of these changes above are breaking, and they have already broken
the state package. These breaking changes will be addressed in other
packages by the next commit.
2020-11-28 17:22:03 -08:00
Maximilian von Lindern 3230916c45
State: don't check store if resource is not tracked through intents (#163)
Partially reviewed; good for the most part.
2020-11-19 10:43:31 -08:00
mavolin aff386402f Gateway: remove GuildSubscriptions from IdentifyData
With the requirement of intents on Gateway v8, the guild_subscriptions field has no effect, and is therefore removed
2020-11-03 10:18:04 -08:00
mavolin 88258b51c2 replace usage of discordapp.com with discord.com in docs 2020-11-03 10:14:53 -08:00
diamondburned a46d3c2c8d wsutil: Added possibly missing Reset cases and more debug logs 2020-10-31 15:54:51 -07:00
Maximilian von Lindern 607250ae55
Gateway: Added reconnect timeout; fixed UA (#154)
* Gateway: use gateway version 8

* API: remove old v0.0.1 version tag

* Discord: fix typos

* Gateway: add timeout

* Gateway: revert to returning errors on ReconnectCtx
2020-10-30 13:41:04 -07:00
diamondburned f3372e016a Gateway: Added missing intents in tests 2020-10-30 12:00:41 -07:00
diamondburned 2a2244c965 Gateway: Use API v8 version instead of its own v6 2020-10-30 11:24:10 -07:00
diamondburned 0ead315aa3 Gateway: Fixed race in test Fatal 2020-10-30 11:15:58 -07:00
diamondburned 16c1658163 {,Voice}Gateway: Refactored Closing
This commit refactors both wsutil, the normal Gateway and the Voice
Gateway to have better closing behavior, which should assume less and
cover edge cases completely.
2020-10-30 11:02:37 -07:00