Commit Graph

1086 Commits

Author SHA1 Message Date
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
twoscott b01675ab92 discord: Add AutocompleteOptions type & Find() 2022-06-05 17:56:52 -07:00
twoscott 15c37ad341 discord: Add Interaction field to Message 2022-05-24 12:01:01 -07:00
twoscott 8cd802e09d discord: Add MessageInteraction type 2022-05-24 12:01:01 -07:00
diamondburned e09abfdbcb
discord: Add StickerURLWithType
This commit adds the StickerURLWithType methods into Sticker and
StickerItem types. No Lottie support is added yet, because I'm not sure
what the filename format for that is.
2022-05-08 16:04:35 -07:00
Juby210 4b6bc657dc
discord: Add permission fields to Command (#326)
* api/discord: add DefaultMemberPermissions and DMPermission to commands
* api/discord: invert DMPermission to match NoDefaultPermission
2022-05-08 03:33:56 -07:00
diamondburned df0fa66c29
discord: Add LikelySpammer 2022-04-17 02:47:48 -07:00
diamondburned c71f48c163
Revert "ws: Add LastAcknowledgedBeat"
This reverts commit 660d9893e1.

The commit introduces regular incorrect reconnections. It will be
tracked in another branch and re-merged later once fixed.
2022-04-12 10:55:42 -07:00
diamondburned bd0369136f
discord: Add InteractionEvent.{Guild,}Locale 2022-04-12 10:43:02 -07:00
diamondburned 660d9893e1
ws: Add LastAcknowledgedBeat
This commit adds ws.Handler.LastAcknowledgedBeat to allow ws.Gateway to
monitor whether or not the server is still reachable.

It fixes #324.
2022-04-12 10:38:41 -07:00
Neo f5f46f5fd4 api: Add localization fields to Application Command creation data 2022-04-12 08:39:44 -07:00
diamondburned f249715c9d
discord: Add localization to Application Commands (#322)
* discord: Add localization to Application Commands
* discord: Created Language type and renamed field.
* discord: Added comments
* api: Add *Client.WithLocale
* discord: Use StringLocales, tweak naming

Co-authored-by: Neo <65282986+Neoration@users.noreply.github.com>
2022-04-11 21:30:25 -07:00
diamondburned c9a96f671a
ws: Clarify CloseEvent.Code 2022-04-11 21:14:07 -07:00
diamondburned 4108d10b44
gateway: Fix RequestGuildMembersCommand 2022-04-08 05:47:21 -07:00
diamondburned 6aefc34992
discord: Add field Proxy into Video
Also added some useful comments in relevant files and moved
OverboundError to discord.go.

See https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
2022-04-08 03:35:20 -07:00
diamondburned 723aa0e4c3
session: Add Gateway{IsAlive,Error} methods
This commit adds the above 2 methods mostly for the user's convenience.

GatewayIsAlive will be useful when handling CloseError events and
determining if the session was fatal without needing to handle Open().

GatewayError builds upon GatewayIsAlive and returns an error. While the
user could call GatewayIsAlive and LastError themselves, doing so
without locking is technically racy if another thread wants to
reconnect.
2022-04-07 23:27:44 -07:00
diamondburned 34db90a16d
state: Fix Messages() OOB panic 2022-04-04 21:36:32 -07:00
diamondburned ec4cd6d661
examples: Add voice example 2022-04-03 17:49:21 -07:00
diamondburned ae24217e34
voice: Allow setting udp.DialFunc
This commit fixes up the SetDialer method to accept a udp.DialFunc
instead of just a regular *net.Dialer, which is more flexible in that
the user can now control the UDP packet frequency properly.
2022-04-03 17:48:15 -07:00
diamondburned 816a53b1e1
gateway: Test ReadyEvent.Version 2022-04-02 22:52:57 -07:00
diamondburned 6b835a58c7
*: Increase test timeout duration
See if CI passes this time.
2022-04-02 22:44:08 -07:00
ItsLychee 92897b4fc3
discord: Support guild Scheduled Events (#319)
* implement the gateway side of guild scheduled event
* Add proper punctuation to each docstring
* Fix UserAdd and UserRemove events
* Add MANAGE_EVENTS permission
* Implement the API-side of scheduled events
* Add ScheduledEvent method
* Cleanup
2022-04-02 22:36:45 -07:00
diamondburned 05948ac1ec
httputil: Fix incorrect Content-Type header 2022-04-02 22:34:41 -07:00
diamondburned 30c63e66d1
discord: Ack.Token nullable 2022-04-02 21:55:26 -07:00