1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-01 12:34:28 +00:00
Commit graph

1044 commits

Author SHA1 Message Date
diamondburned bf75621068
httpdriver: Add ExpectMockRequest
This commit adds the httpdriver.ExpectMockRequest function, which will
be super useful for testing inside and outside the library.
2022-12-08 19:38:59 -08:00
diamondburned 3bb8c2b019
httpdriver: Add Method into MockRequest 2022-12-08 19:17:28 -08:00
diamondburned d4bfd69cf6
httpdriver: Add Mock{Request,Response}
This commit adds MockRequest and MockResponse to aid in testing.

It doesn't provide a MockClient, since there are multiple testing
strategies and we don't want to do them all.
2022-12-08 17:16:11 -08:00
diamondburned cd1a044bc8
voice: Fix voicegateway.SpeakingFlag being invalid
Thanks, @topisenpai!
2022-12-07 00:25:55 -08:00
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