Commit Graph

1005 Commits

Author SHA1 Message Date
ayn2op dc3453beaa
discord: Add NitroBasic to UserNitro type (#364) 2023-01-02 14:46:14 +07:00
ayn2op 7f6871077a
discord: Add AutoModerationActionMessage (#362) 2023-01-02 14:28:43 +07:00
ayn2op f7164d6520
discord: Add Guild.NSFWLevel (#363) 2023-01-02 14:25:45 +07:00
diamondburned c0a522a93e
session: Add OnInteractionError that logs by default 2023-01-01 18:01:08 +07:00
diamondburned 3b98cde06f
README: Fix bare minimum example 2022-12-10 06:03:57 -08:00
diamondburned ced922d377
examples: Update commands to use cmdroute 2022-12-10 06:03:04 -08:00
diamondburned 080c734b37
cmdroute: Add OverwriteCommands
This adds a small helper function just for convenience.
2022-12-10 06:02:37 -08:00
diamondburned feb624758b
README: Slight restructure
This commit rewrites some parts of the README.

It removes the section about package bot, because we all should just
forget that it ever existed. Thanks, Discord.

It also removes a section that compared the library against Discordgo.
The section was written 3 years ago so it was very outdated. Instead, it
is replaced with a "Library Highlights" section, which provides much
more insights on the library itself.
2022-12-10 05:21:56 -08:00
diamondburned 99e5f6c2b8
httpdriver: Fix MockRequest.AddHeader crash 2022-12-09 15:39:33 -08:00
diamondburned b3b2478481
httpdriver: ExpectMockRequest should return error instead 2022-12-08 19:48:57 -08:00
diamondburned ea4beab6bd
httpdriver: Fix MockResponse not impl'ing Response 2022-12-08 19:42:22 -08:00
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