Commit Graph

959 Commits

Author SHA1 Message Date
diamondburned b6f6372816
Fix up naming and minor fixes 2022-09-21 13:10:59 -07:00
Sven Wiltink 2a62859e4e set correct json flags 2022-09-21 15:52:02 +00:00
Sven Wiltink b7421315ea Add Tag and TagID for forum capabilities 2022-09-21 15:08:17 +00: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
twoscott 2013da8255 discord: Add Invite.URL() methods 2022-07-22 15:35:49 -07:00
twoscott fb2032d538 discord: name Member guild ID params appropriately 2022-07-20 00:07:55 -07:00
twoscott c84e7f6712 discord: Fix TextInputComponent min & max fields 2022-07-15 20:36:38 -07:00
diamondburned 8c338b49ba
Fix invalid TextInputComponent.{Min,Max}Values
Fixes #333.
2022-07-15 18:37:39 -07:00
twoscott e1c4f0f041 discord: Fix comment spacing 2022-07-11 02:47:37 -07:00
twoscott 2c86cfe7a6 discord: Add AttachmentOption type 2022-07-10 14:30:51 -07:00
twoscott 09c3314cc2 discord: Add resolved interaction attachments 2022-07-10 14:30:51 -07:00
Vendicated c1e8daec60 Add TargetMessageID and TargetUserID convenience functions 2022-07-05 13:21:22 -07:00
Vendicated fc2319e652 Add GuildID and TargetID to CommandInteraction 2022-07-05 13:21:22 -07:00
diamondburned 384a3dd433
discord: Add NewAPIEmoji 2022-06-23 00:11:27 -07:00
diamondburned be9de2c165
state: Fix Ready not resetting fewMessages 2022-06-23 00:09:20 -07:00
diamondburned faec1da257
discord: Fix Emoji.String 2022-06-19 23:03:09 -07:00
twoscott ea5251df0f examples: Update Autocomplete example 2022-06-05 17:56:52 -07:00
twoscott 33fbc1a1a2 api: Allow all types for api choices 2022-06-05 17:56:52 -07:00
twoscott 8732dc1ff6 discord: Allow multiple types for AutocompleteOption Value 2022-06-05 17:56:52 -07:00