Commit Graph

162 Commits

Author SHA1 Message Date
diamondburned 9899f6073b Bot: Added automatic Intents detection from handlers
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.
2020-10-28 22:49:18 -07:00
diamondburned b8e4b2cf56 Gateway: Added an Event to Intents map for convenience 2020-10-28 19:44:04 -07:00
diamondburned c00d31ce30 Gateway: Added missing MessageReactionRemoveEmojiEvent constructor 2020-10-28 19:39:18 -07:00
diamondburned fd16db1385 Gateway: Fixed MessageReactionRemoveEmoji not having Event suffix 2020-10-28 19:31:43 -07:00
diamondburned 75df94d9f4 *: Migrated Go Modules to v2 2020-10-28 15:39:59 -07:00
diamondburned 8aa60ebf8e *: Removed the Game field
The Activities field should now be used. Access the first element.
2020-10-28 14:01:08 -07:00
diamondburned 6c332ac145 {Voice,}Gateway: Fixed various race conditions
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.
2020-10-22 10:47:27 -07:00
diamondburned 91ee92e9d5 Gateway: Fixed a race condition on ReconnectOP 2020-10-21 22:42:16 -07:00
diamondburned 1bec57523d Gateway: GuildSubscribeData should omit empty Channels map 2020-10-17 03:18:50 -07:00
diamondburned 86dd05da9e Gateway: Fixed empty Query on RequestGuildMembersData broken 2020-10-16 02:17:59 -07:00
diamondburned fd818e181e Gateway: GuildFolderID is now a signed int because Discord 2020-08-19 21:54:20 -07:00
diamondburned de61fd912d wsutil: Made PacemakerLoop valid as zero-value 2020-08-19 21:30:57 -07:00
diamondburned af7f413cea Gateway: Clarified GuildMemberListGroup.ID docs 2020-08-14 21:13:48 -07:00
diamondburned c819b56170 Gateway: Added a custom GuildFolderID type 2020-08-14 18:13:35 -07:00
diamondburned eb46a89e6c Gateway: Fixed GuildFolder.ID unmarshaling 2020-08-14 17:57:06 -07:00
diamondburned 77b1b08bce Heart: Better synchronization on close methods 2020-07-30 12:44:50 -07:00
Maximilian von Lindern 1585797b52 *: Linting and typo fixes (#134)
* Linting and typo fixes

* Linting and typo fixes

* revert comma fix
2020-07-29 16:58:33 -07:00
Tadeo Kondrak b8f6fbbda9 Gateway: Fix type of GuildFolder.ID 2020-07-29 16:58:33 -07:00
Tadeo Kondrak d290b0d01c *: Add typed Snowflake IDs (#122)
This PR closes #120.
2020-07-29 16:58:33 -07:00
diamondburned 24f7ed0499 Gateway: ReconnectCtx now returns error; fixed test 2020-07-18 18:33:07 -07:00
diamondburned 6717f8002c Gateway: Fixed autoreconnect misusing context 2020-07-15 16:39:40 -07:00
diamondburned a1038cb8bb Gateway: Fixed wrong usage of Context in Gateway reconnection 2020-07-15 16:32:53 -07:00
diamondburned 9d7f5cb953 Gateway: Deprecated useless type definitions for embedded structs 2020-07-14 21:38:31 -07:00
diamondburned 7572caad31 Discord: Added Relationship API methods; moved structs around 2020-07-14 18:01:24 -07:00
diamondburned 91e494ba51 Gateway: Changed Relationship struct for type and name claritifcation 2020-07-11 13:25:29 -07:00
diamondburned edb8a46ef2 Gateway: Added intent helpers and more context API support 2020-07-11 12:50:32 -07:00
diamondburned d3d9811276 Gateway: Added Relationship events and handlers; minor reformatting 2020-07-11 00:02:57 -07:00
diamondburned (Forefront) 64c6ca7916 Gateway: Fixed GuildCreateEvent not having Channels 2020-05-17 22:48:16 -07:00
mavolin 41ce1f389e
make all error messages lowercase 2020-05-16 23:14:49 +02:00
diamondburned (Forefront) adb23eeb8e Gateway: Added new InviteCreateEvent and InviteDeleteEvent 2020-05-12 17:51:23 -07:00
mavolin f453c1eefa
Gateway: Fix #45 2020-05-12 04:54:16 +02:00
diamondburned (Forefront) 23b0abdfec Adopted several packages to use NullSnowflake and NullSeconds 2020-05-08 14:25:07 -07:00
diamondburned (Forefront) 51e88a47b2 Gateway/Voice: Improved the event loop, fixed race conditions 2020-04-25 00:13:07 -07:00
diamondburned ccf4c69801
Merge pull request #14 from matthewpi/feature/voice 2020-04-24 19:58:26 -07:00
diamondburned (Forefront) 95624292f7 Gateway: Deprecated OP chan API, use PacerLoop.Extras instead 2020-04-24 15:32:14 -07:00
diamondburned (Forefront) 54ac0a6951 Gateway: Migrated to wsutil.PacemakerLoop 2020-04-24 15:30:15 -07:00
diamondburned (Forefront) 443ec791af Heart: Moved PacemakerLoop to wsutil, changed Gateway abstractions to generic ones 2020-04-24 15:09:05 -07:00
diamondburned (Forefront) 2f076c041e Gateway: Migrated functions and variables to other packages, added JSON default codecs 2020-04-23 23:34:08 -07:00
diamondburned (Forefront) a2a1ccd01e Gateway: Fixed Invalid Session retrying forever bug 2020-04-22 14:45:19 -07:00
Matthew Penner f429010ded Add janky voice support 2020-04-21 16:37:22 -06:00
diamondburned (Forefront) 5c85e4aa64 Gateway: Fixed a typo in GuildCreateEvent 2020-04-21 15:32:00 -07:00
diamondburned (Forefront) 748ad5641c API: Added AllowedMentions and more tests 2020-04-19 16:35:37 -07:00
diamondburned (Forefront) 2afe683b7d Utils: Added HTTP drivers 2020-04-19 14:53:53 -07:00
diamondburned (Forefront) bf93a9cee9 Changed endpoint constants to variables 2020-04-19 09:30:12 -07:00
diamondburned (Forefront) b9384042bb Gateway: Added GatewayBot 2020-04-19 09:17:04 -07:00
diamondburned (Forefront) 813be25713 Gateway: Fixed infinite InvalidSession loop 2020-04-13 18:23:38 -07:00
diamondburned (Forefront) 9873d475aa State: Added Reaction state handlers 2020-04-12 16:14:27 -07:00
diamondburned (Forefront) 4e4ebde93a Gateway: Deprecated Wait(), fixed ReconnectOP bug 2020-04-12 11:06:43 -07:00
diamondburned (Forefront) 320e8a52f1 Gateway: Fixed unexpected ticker.Stop() blocking behavior 2020-04-11 20:38:10 -07:00
diamondburned (Forefront) 01e52334c6 Gateway: Possible bug fix, added more verbose debugging 2020-04-11 17:47:09 -07:00
diamondburned (Forefront) 06136b7d5f Websocket: Replaced Conn's mutices with channels 2020-04-10 20:03:52 -07:00
diamondburned (Forefront) cc530ce7a2 Bot: Allow func(T), added more documentation, minor fixes 2020-04-09 13:49:12 -07:00
diamondburned (Forefront) be12849668 Changed internal/ to utils/, allowing external imports 2020-04-08 19:28:40 -07:00
diamondburned (Forefront) 6dafb30401 State: Added more wrappers for direct messaging channels 2020-04-07 19:33:56 -07:00
diamondburned (Forefront) e8694c74e5 Gateway: Slightly better documenting 2020-04-07 12:26:15 -07:00
diamondburned (Forefront) 2f597ebc0b Session: Added an AfterClose handler as a *session.Close event 2020-04-06 19:36:06 -07:00
diamondburned (Forefront) 33061e916f Gateway: Now waits for either READY or RESUMED before finishing Open() 2020-04-06 13:27:33 -07:00
diamondburned (Forefront) 9f5c2ac958 Gateway: Switched to gorilla/websocket, fixes #11 2020-04-06 13:27:29 -07:00
diamondburned (Forefront) b5f7af70f3 Gateway: Changed UpdateStatus to be more valid 2020-03-31 20:45:56 -07:00
diamondburned (Forefront) f71852604b Gateway: Fixed Since omitempty condition 2020-03-30 23:02:25 -07:00
diamondburned (Forefront) 727f23f8f4 Gateway: Added missing Activities slice in UpdateStatus 2020-03-30 22:22:32 -07:00
diamondburned (Forefront) c9829b9e28 Gateway: Fixed invalid Since type for UpdateStatusData 2020-03-30 21:46:03 -07:00
diamondburned (Forefront) 00481b5490 Gateway: Fixed UserNotification constants 2020-03-26 19:11:25 -07:00
diamondburned (Forefront) 85f8b44e7e Gateway: Updated UserNotification for Channel user settings 2020-03-26 17:04:14 -07:00
diamondburned (Forefront) 86b1120875 Gateway: Changed Notification to UserNotification to avoid confusion with discord.Notification 2020-03-26 17:03:19 -07:00
diamondburned (Forefront) 3a1b1c22fc Gateway: Added missing Notification constant and SupressRoles field 2020-03-26 16:28:43 -07:00
diamondburned (Forefront) 743a8a8fd9 API: Fixed FormatEmojiAPI 2020-03-22 15:23:29 -07:00
diamondburned (Forefront) b59d9bfed7 Arikawa: Updated /x/errors; Gateway: Added TestInvalidToken 2020-03-16 18:29:23 -07:00
diamondburned (Forefront) 8899462ff0 Gateway: Added undocumented GuildMemberListUpdate event 2020-03-15 22:55:45 -07:00
diamondburned (Forefront) 22ef50c499 Gateway: Fixed bug where WS errors block forever 2020-03-07 11:50:30 -08:00
diamondburned (Forefront) 403e4970f7 Gateway: Fixed a deadlocking mutex 2020-03-02 19:18:33 -08:00
diamondburned (Forefront) 0aebea60bd Gateway: Minor bug fixes 2020-03-01 16:39:40 -08:00
diamondburned (Forefront) f0102d765f Gateway: Added a retry limit
State: Event handlers now handle all of Ready's Guilds field
Session: Added Wait, which blocks until SIGINT or Gateway error
2020-02-29 18:13:58 -08:00
diamondburned (Forefront) 220eb5ff42 Gateway: Fixed OP chan not having a concrete type 2020-02-25 22:37:26 -08:00
diamondburned (Forefront) 79c4c1caca Gateway/State: Added message acking and more user update events for State 2020-02-24 21:50:13 -08:00
diamondburned (Forefront) 4a1d6ad456 Gateway: Added SESSIONS_REPLACE 2020-02-23 09:56:16 -08:00
diamondburned (Forefront) ce59298937 Gateway: Changed Intents' type from uint16 to uint32 for future constants 2020-02-21 23:38:51 -08:00
diamondburned (Forefront) 64aca9ea40 Gateway: Prepare for the new intents update
https://discordapp.com/developers/docs/topics/gateway#gateway-intents
2020-02-21 23:35:11 -08:00
diamondburned (Forefront) 587d36fd6c Gateway: Open now fails at once, only Reconnect retries forever. 2020-02-19 19:36:00 -08:00
diamondburned (Forefront) 7b24f58496 Gateway: Fixed typo in Request Members data 2020-02-17 13:11:48 -08:00
diamondburned (Forefront) 4e9bd53b0f Gateway: Added extra events 2020-02-15 21:29:25 -08:00
diamondburned (Forefront) 0de1e579f3 State: Author* methods now try and use Message.Member 2020-02-12 20:19:24 -08:00
diamondburned 76c7760c24 Gateway: Removed redundant context 2020-02-11 09:29:30 -08:00
diamondburned 3288f2d19c
Gateway: Fix race conditions and fatal reconnecting (#7) 2020-02-07 22:17:27 -08:00
diamondburned (Forefront) 0761dfabee Discord: Fixed invalid types for ReadyEvent's GuildFolders 2020-02-06 20:37:59 -08:00
diamondburned (Forefront) 85b793a1a7 Fixed some race conditions 2020-02-02 14:12:54 -08:00
diamondburned (Forefront) b62ba3ecc0 More race condition fixes 2020-01-28 19:54:22 -08:00
diamondburned (Forefront) 3770927a48 Bot: trivial fixes 2020-01-28 16:01:39 -08:00
diamondburned (Forefront) ea9f2c2036 Fixed Webhook Update event 2020-01-24 21:24:33 -08:00
diamondburned (Forefront) 7af350ba55 Added WebhooksUpdate event 2020-01-23 22:35:50 -08:00
diamondburned (Forefront) 3ca1d352c9 Fixed a ridiculous race condition in the gateway 2020-01-20 03:06:20 -08:00
diamondburned (Forefront) aa4154e73c Minor fixes that doesn't really fix anything 2020-01-20 01:32:28 -08:00
diamondburned (Forefront) 27e315ca66 Fixed bug where message state would screw up 2020-01-20 00:53:23 -08:00
diamondburned (Forefront) ac685b0df4 Minor fixes, undocumented things, and editorconfig 2020-01-19 13:54:16 -08:00
diamondburned (Forefront) 6b6f9f96aa When in doubt, use brute force. 2020-01-18 22:46:45 -08:00
diamondburned (Forefront) 841128dc88 Fixed gateway integration test 2020-01-18 22:34:52 -08:00
diamondburned (Forefront) 7f06d88d0f Updated heartbeat behavior 2020-01-18 22:22:03 -08:00
diamondburned (Forefront) 9651de81c6 Heartbeat can now resume, bot will fatal (die) if it can't reconnect 2020-01-18 22:14:46 -08:00
diamondburned (Forefront) a82d71ad3c Added more Gateway commands 2020-01-18 14:35:07 -08:00
diamondburned (Forefront) 5b0687bcd3 Added state example 2020-01-18 13:40:09 -08:00