1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-16 11:54:29 +00:00
Commit graph

990 commits

Author SHA1 Message Date
diamondburned 5811606559
gateway: Fix Send rate limiting
Prior to this commit, gateways can send 120 events before being
throttled at a terribly slow rate of 1 send per minute.

This commit permits gateways to send 5 events before being throttled at
a rate of slightly less than 120 events per minute.
2022-12-07 00:25:55 -08:00
diamondburned 789afaa88f
session: Fix Connect->Open not handling ctx 2022-12-07 00:25:55 -08:00
Jason Chu 4db60bca9d
voice: Close previous UDP sessions on Continue (#358) 2022-12-03 19:39:43 -08:00
Sam Xie 12a84ee999
discord: Add omitempty tag for category id (#357) 2022-11-28 14:54:25 -08:00
Tyler Stuyfzand 769215970e
session: Introduce SendGateway (#356)
* Support SendGateway to help with voice usage

* Remove unnecessary Gateway interface function

* Add clarification comment

Co-authored-by: Tyler <admin@meow.tf>
2022-11-25 11:16:13 -08:00
Sam Xie 91c86f02ec
discord: Add PermissionViewGuildInsights (#355) 2022-11-24 21:04:52 -08:00
twoscott 1b31249626 discord: Add new select components 2022-11-20 20:17:44 -08:00
twoscott e5aabda660 discord: Add StringOption Min/MaxLength 2022-11-20 20:16:58 -08:00
diamondburned eb23d43cee
session: Connect to retry on non-fatal errors 2022-11-18 02:09:16 -08:00
diamondburned 5a156cc699
gateway: Expose GatewayOpts getter 2022-11-18 02:01:18 -08:00
diamondburned 78ad477b83
Add GatewayOpts.ErrorIsFatalClose 2022-11-17 22:07:52 -08:00
diamondburned 87c479a2dc
gateway: Use PartialUnmarshal for ReadyEventExtras 2022-11-03 02:30:25 -07:00
diamondburned 60ed12f3c0
gateway: Add Ready.SessionID 2022-10-31 04:34:21 -07:00
diamondburned f8d6199e80
gateway: Re-type SessionsReplaceEvent 2022-10-31 04:30:10 -07:00
diamondburned 60bcb4c966
gateway: Add Ready.Sessions 2022-10-31 04:11:45 -07:00
diamondburned 181dcb1bdd
api: Introduce api/cmdroute
This commit introduces a slash commands and autocompletion router. It
abstracts the switch-cases that the user has to do in each
InteractionEvent handler away.

The router is largely inspired by go-chi's design. Refer to the tests
for examples.
2022-10-13 23:01:29 -07:00
diamondburned 329ad0f404
discord: Add AutocompleteOptions.Unmarshal 2022-10-13 23:01:29 -07:00
diamondburned b6221c6426
discord: Use the right type for AutocompleteOption.Options 2022-10-13 23:01:28 -07:00
diamondburned 70a7a3e44f
discord: Add some omitempty for interaction.go 2022-10-13 23:01:28 -07:00
zBNF e058e7c7b7
api: Allow disabling interaction pubkey verification (#350)
* feat: add support for disabling signature verification

* feat: refactor solution to not break api

* feat: make InteractionServer.ServeHTTP use InteractionServer.httpHandler
2022-10-11 18:01:31 -07:00
diamondburned 83cf774073
gateway: Separate Ready to ReadyEventExtras
This commit separates the undocumented fields of Ready to
ReadyEventExtras. Realistically, this is never an issue for bots, but it
might cripple non-bot users when Discord makes breaking changes to the
API.

This change allows Ready to still be unmarshaled even when the
undocumented fields cannot be unmarshaled. It also adds a new json.Raw
field that allows the whole Ready event to be unmarshaled differently.

This new ReadyEventExtras is also no longer marshaled as part of Ready.
Instead, none of its field will be present. Although this is a breaking
change, it solely concerns non-bot APIs, so it's acceptable.
2022-10-03 23:18:43 -07:00
diamondburned 1af71182d0
session: Add DontWaitForReady
This is a workaround for some cases where ReadyEvent cannot be delivered
successfully, e.g. in the case of an unmarshal failure.

We should handle BackgroundErrorEvents in the future that fatally exits
on any unmarshal errors.
2022-10-03 22:37:40 -07:00
diamondburned a14fcb893a
session: Fix Open not dying on ctx.Done 2022-10-03 22:10:20 -07:00
diamondburned d952c98829
gateway: Fix RequestGuildMembersCommand.GuildIDs 2022-10-03 04:48:50 -07:00
diamondburned d97492348d
gateway: Fix RequestGuildMembersCommand for empty query 2022-10-03 04:47:04 -07:00
diamondburned afeacebced
gateway: Removed unused test functions 2022-10-03 04:47:04 -07:00
Samuel Hernandez 3ae45b7816 api: *ArchivedThreadsBefore to *ArchivedThreads, allow empty Limit 2022-10-01 22:02:28 -07:00
diamondburned dc5454895e
examples: Update commands/ from commands-hybrid/ 2022-10-01 19:40:19 -07:00
diamondburned e3e35a9628
README: Warn against use of messages for bots 2022-10-01 19:37:15 -07:00
diamondburned 219b1d80d6
api: Fix incorrect use of ArchivedThreads
This commit fixes the several ArchivedThread API getters to unmarshal to
the right type. Prior to this commit, things don't work.
2022-10-01 19:35:41 -07:00
samhza 0c7539c6d5
discord: Add Attachment.Description (#347) 2022-09-28 15:22:29 -07:00
svenwiltink fa35b32b79
discord: Add ChannelFlags (#345)
* added ChannelFlags

* Minor style fixes, comment additions

Co-authored-by: diamondburned <diamond@arikawa-hi.me>
2022-09-23 00:00:04 -07:00
svenwiltink 238a91b2fc
discord: Add Tag for forum (#344)
* Add Tag and TagID for forum capabilities

* set correct json flags

* Fix up naming and minor fixes

Co-authored-by: diamondburned <diamond@arikawa-hi.me>
2022-09-21 13:17:26 -07:00
Sam 5870d04644
discord: Add Message.ApplicationID (#343) 2022-09-21 10:30:12 -07:00
diamondburned d96ce0f54c
discord: Add Guild{Directory,Forum} 2022-09-19 14:55:54 -07:00
diamondburned 10589eab14
gateway: Do not resume after 15m
Fixes #341.

Unsure if this is a good idea, but 15 minutes seems enough.
2022-09-13 19:50:42 -07:00
diamondburned 91b2c6c840
session: Add AddInteractionHandlerFunc
Also remove session.AddInteractionHandler (exported func).
2022-08-23 13:46:42 -07:00
diamondburned 75ff7342b1
api: Add InteractionHandlerFunc 2022-08-23 13:42:29 -07:00
diamondburned 0f0c968634
README: Add commands-hybrid, minor tweaks 2022-08-23 13:37:10 -07:00
diamondburned 9de994c73c
examples: Add commands-hybrid 2022-08-22 23:45:07 -07:00
diamondburned 0d95310dd2
state: Finish comments for NewAPIOnlyState 2022-08-22 23:12:08 -07:00
diamondburned 9e9f90a652
webhook: Add missing Content-Type for Pong 2022-08-22 14:43:49 -07:00
p5nbTgip0r dcfc9b19d1 gateway: Add IsPending for GuildMemberUpdateEvent 2022-08-22 14:43:29 -07:00
p5nbTgip0r 88e467ba8c discord: Fix json tag for Guild.MFA 2022-08-22 14:43:29 -07:00
diamondburned 22e8d607ad
api: Fix InteractionServer's writeError 2022-08-22 03:21:12 -07:00
diamondburned f00054bddf
webhook: Add session+state helpers 2022-08-22 02:18:54 -07:00
diamondburned 17c26bf488
webhook: Add InteractionServer
This commit adds Interaction webhook server support directly into the
library.

Bots can now support both receiving events through the Discord gateway
and the Interaction webhook handler within the same library.
2022-08-22 02:18:00 -07:00
diamondburned a25b21d020
api: omitempty InteractionResponseData.Choices 2022-08-22 02:08:28 -07:00
diamondburned d62c1169b5
session: Remove unused function initConnect 2022-08-22 01:08:24 -07:00
diamondburned a1334c45f4
api: Revert "Revert 'Add FollowUpInteraction'"
This reverts commit 96b8e2b8e5.

The commit that is being reverted was created on the wrong commit.
2022-08-21 00:58:57 -07:00