1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-09 00:14:57 +00:00
Commit graph

974 commits

Author SHA1 Message Date
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
diamondburned 015b1cdf6f
state: Revert "Cache CurrentApplication"
This reverts commit 7e49429.

The initial goal of this addition is to be used for interaction
followups, but the interaction event already comes with the application
ID.

The addition was also not done properly, and no invalidation on event is
done.
2022-08-21 00:58:01 -07:00
diamondburned 96b8e2b8e5
api: Revert "Add FollowUpInteraction"
This reverts commit 2aaa2002d8.

The initial goal of this addition is to be used for interaction
followups, but the interaction event already comes with the application
ID.

The addition was also not done properly, and no invalidation on event is
done.
2022-08-20 16:15:50 -07:00
diamondburned 7e49429f4b
state: Cache CurrentApplication
This commit adds these methods into *state.State:

    - (*State).CurrentApplication
    - (*State).CurrentApplicationID

This should make interacting with API functions that require AppIDs much
more pleasant.
2022-08-20 16:07:25 -07:00
diamondburned 2aaa2002d8
api: Add FollowUpInteraction
Deprecate CreateInteractionFollowup in favor of FollowUpInteraction
because it has a shorter and more concise name.
2022-08-20 16:06:33 -07:00
diamondburned 7961d18278
discord: ContainerComponents.Unmarshal for number types
This commit adds int*, uint* and float* parsing support into
ContainerComponents.Unmarshal.
2022-08-20 09:39:24 -07:00
diamondburned 6412cf74ff
api: Add and deprecate EphemeralResponse
Follow-up to previous commit.
2022-08-18 23:25:13 -07:00
diamondburned 530f0c5622
api: add and deprecate InteractionResponseFlags
This commit builds upon eb579c8, which deprecates the type in favor of
an existing one. It adds code that preserves backwards compatibility.
2022-08-18 23:22:40 -07:00
Samuel Hernandez eb579c8e94 api: remove InteractionResponseFlags in favor of discord.MessageFlags
See docs:
https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-messages

This is an API change. Use the following commands to update your
projects:

	$ gofmt -w -r 'api.InteractionResponseFlags -> discord.MessageFlags'
	$ gofmt -w -r 'api.EphemeralResponse -> discord.EphemeralMessage'
2022-08-18 22:57:40 -07:00
diamondburned adce55b02d
discord: Add ContainerComponents.Unmarshal
This feature is similar to the one added a few commits prior.
2022-08-15 14:57:30 -07:00
diamondburned af940e5a37
gateway: Workaround for lack of heartbeat revival
Fixes a regression from v2's gateway.
2022-08-15 14:09:53 -07:00
diamondburned 10fd739d9e
discord: Type validation for CommandInteractionOptions.Unmarshal 2022-08-15 00:13:12 -07:00
diamondburned 47c06557c2
discord: Add CommandInteractionOptions.Unmarshal
This commit adds an Unmarshal method into CommandInteractionOptions. It
is probably the first commit to break the rule of keeping package
discord simple.

The goal of this rationale is that package discord should continue
prioritizing convenience and ease of use by providing small, helpful
additions without being oversized.

This method, while it uses reflect, is actually fairly small in
implementation. Its functionality should be kept to a bare minimum and
as such will not cover every single use case (but should cover most).
2022-08-14 23:40:06 -07:00
diamondburned 6bf83a4747
discord: Document *TextInputComponent in Component, ContainerComponents 2022-08-14 21:48:37 -07:00
diamondburned 0321b9247f
discord: Document *ModalInteraction in InteractionData 2022-08-14 21:45:47 -07:00
diamondburned 258b6149d7
session: Add Connect and Wait
This commit adds the Connect and Wait methods into session. This gives
the user a way to block the program until the session runs into an error
or the given ctx is done.

In most cases, Connect is useful when combined with
signal.NotifyContext, and so Connect is preferred over Open.
2022-08-14 16:11:40 -07:00
diamondburned 0ae6f6690a
shard: Fix fmt 2022-08-14 16:11:40 -07:00