1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-12 18:02:59 +00:00
Commit graph

918 commits

Author SHA1 Message Date
diamondburned a4a9a24424 CI: Enabled race detector in tests 2020-10-29 11:38:54 -07:00
diamondburned 2afcd1bc87 Merge Gateway regression fixes from v1 2020-10-29 11:32:54 -07:00
diamondburned f88d4e4b1e Gateway: Fixed wsutil build fail regression 2020-10-29 11:32:30 -07:00
diamondburned 8d21c5f43f Merge wsutil bug fixes and changes onto v2 2020-10-29 11:25:09 -07:00
diamondburned 7668fe940c wsutil: Websocket wrapper thread safety for simpler Conn impl
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.
2020-10-29 11:24:45 -07:00
diamondburned 9b4b707070 Handler: Use a free list over a linked list 2020-10-28 23:55:39 -07:00
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 ef48d686cd Handler: Changed to a linked list instead of a slice-backed map
This change should slightly improve the performance of the handler
container.

A rough benchmark was written and tested; the source code is at
https://gist.github.com/diamondburned/c369d13efda5c702a0e59874deee64bd.
2020-10-28 22:37:38 -07:00
diamondburned b7b8118d0b State: Fixed breaking change from previous Gateway change 2020-10-28 19:47:22 -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 33e7abd4db Merge wsutil fix from v1 into v2 2020-10-28 19:03:10 -07:00
diamondburned 160a4e6606 wsutil: Fixed data races involving getters 2020-10-28 19:00:59 -07:00
diamondburned 75df94d9f4 *: Migrated Go Modules to v2 2020-10-28 15:39:59 -07:00
diamondburned 6183068c4d Discord: Fixed incorrect OverwriteType string rules 2020-10-28 15:34:14 -07:00
diamondburned f9f254148f API: Fixed rate limiting tests 2020-10-28 15:23:47 -07:00
diamondburned 795cbdef53 Discord: Fixed redundant and broken OverwriteType 2020-10-28 14:49:30 -07:00
diamondburned 196cab2105 API: Better documented ModifyGuildWidgetData 2020-10-28 14:43:49 -07:00
diamondburned 994ddca1e1 Discord: Updated the Presence struct to be smaller
This commit omits a few fields in the Presence struct in accordance to
the new v8 structures.

    Removed roles, premium_since, and nick
2020-10-28 14:39:44 -07:00
diamondburned 2af51c9a5a API: V8 breaking rate limit changes
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.
2020-10-28 14:31:15 -07:00
diamondburned d405cc22b7 Discord: Embed fields deprecated 2020-10-28 14:13:19 -07:00
diamondburned 7a757209c2 Discord: Minor changes in Overwrite for v2
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.
2020-10-28 14:08:29 -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 6ce268a7fa Gateway: Changed endpoint from v6 to v8 2020-10-28 13:56:11 -07:00
diamondburned 16a408bf30 wsutil: Refactored and decoupled structures for better thread safety 2020-10-28 10:19:22 -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 86795e42a6 Session: Fixed a potential race condition on Close 2020-10-21 22:42:16 -07:00
Maximilian von Lindern 397d288927
API: fix errors in message pagination and streamline changes with other pagination methods (#150)
* 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
2020-10-19 07:47:43 -07:00
diamondburned dec39c4c2d API: Fixed Messages{Before,After} fetching incorrectly beyond 100s 2020-10-18 22:14:49 -07:00
mavolin 6dabffb46c State: fix case where Role would return nil error, even though no role was found 2020-10-18 13:44:37 -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
mavolin 647efb8030 Discord: add Mention method to mentionable Snowflakes 2020-09-24 11:54:45 -07:00
diamondburned 64ab8c4f30 Bot: Fixed trailing backticks causing out of bound panic 2020-08-29 22:09:58 -07:00
mavolin 5acf9f3f22 Discord: fix invalid role mention generation 2020-08-24 16:32:51 -07:00
mavolin 7d5cc89ff0 API: add KickWithReason 2020-08-22 10:05:37 -07:00
diamondburned 6b4e26e839 wsutil: Improved internal code 2020-08-20 14:15:52 -07:00
diamondburned fd818e181e Gateway: GuildFolderID is now a signed int because Discord 2020-08-19 21:54:20 -07:00
diamondburned 87c648ae1d Discord: ParseSnowflake now uses ParseUint 2020-08-19 21:53:22 -07:00
diamondburned 3312c66515 Voice: Made EventLoop a valid struct value instead of nil pointer 2020-08-19 21:32:40 -07:00
diamondburned de61fd912d wsutil: Made PacemakerLoop valid as zero-value 2020-08-19 21:30:57 -07:00
diamondburned f0c73f4c99 State: Ready events now automatically reset the state 2020-08-18 10:20:48 -07:00
Maximilian von Lindern a7e9439109
Discord/API: implement changes to permission, allow and deny fields (#141) 2020-08-17 17:10:43 -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 d888a5a7ac Bot: Added better middleware documentation 2020-08-11 17:31:29 -07:00
diamondburned 3db68bcb0e Bot: Allow hanging quotes if command has a custom parser 2020-08-11 13:44:32 -07:00