Commit Graph

230 Commits

Author SHA1 Message Date
p5nbTgip0r 88e467ba8c discord: Fix json tag for Guild.MFA 2022-08-22 14:43:29 -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 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 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
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 faec1da257
discord: Fix Emoji.String 2022-06-19 23:03:09 -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 bd0369136f
discord: Add InteractionEvent.{Guild,}Locale 2022-04-12 10:43:02 -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 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
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 406171d7a9
discord: Deprecate MemberColor
Also fix State failing to fill up GuildID fields in Messages().
2022-04-01 04:42:23 -07:00
diamondburned 0cc36ee51e
discord: Add Color.String 2022-03-31 11:46:45 -07:00
diamondburned eae129c928
discord: MemberColor return bool 2022-03-31 11:42:22 -07:00
diamondburned eec8fcf719
discord: Clarify that IsNull isn't useful 2022-03-15 13:37:35 -07:00
Ven c0bfc217ca
discord: Add Icon/Emoji & Tags to Role (#313)
* discord: Add Icon/Emoji & Tags to Role
* oops :P
* Add Icon/Emoji to api/role
* Fix doc
* Fixes
2022-02-17 18:07:03 -08:00
Tyler Stuyfzand 6dc189519c
discord: Add Type to CommandInteractionOption (#312) 2022-02-13 22:40:26 -08:00
Tyler Stuyfzand c5f8fff98f
discord: Add Autocomplete flag to some options (#311)
* Add Autocomplete flags to Number and Integer options
* Add autocomplete warning for choices
2022-02-13 22:39:32 -08:00
ItsLychee d6bc738e50
discord: Modal interaction support (#310)
* Support modal interactions along with the TextInput component

* Replace ModalInteraction with Modal to prevent confusion

* Fix the required field from not being used correctly

* PR Fixes
2022-02-13 19:15:28 -08:00
diamondburned 3fe7fbc24b
discord: Add StickerItem, fix Sticker.TagList 2022-01-29 03:38:10 -08:00
PL Pery 9cd0c7ed28
discord: Add CommandInteractionOptions (#300)
* feat: Find method on options

* doc comment
2022-01-03 13:37:18 -08:00
diamondburned bfd668ff99
discord: Fix unmarshaling PingInteraction 2022-01-02 23:55:57 -08:00
diamondburned c14e68ac77
discord: Add missing NumberOption MarshalJSON 2021-12-29 11:10:59 -08:00
diamondburned 5c4a989746
discord: Add CommandInteraction.Resolved 2021-12-27 15:10:09 -08:00
starshines bc8a2b0cae
discord: Add timeouts (#299) 2021-12-20 15:56:11 -08:00
diamondburned 54cadd2f45 gateway: Refactor for a better concurrent API
This commit refactors the whole package gateway as well as utils/ws
(formerly utils/wsutil) and voice/voicegateway. The new refactor
utilizes a design pattern involving a concurrent loop and an arriving
event channel.

An additional change was made to the way gateway events are typed.
Before, pretty much any type will satisfy a gateway event type, since
the actual type was just interface{}. The new refactor defines a
concrete interface that events can implement:

    type Event interface {
        Op() OpCode
        EventType() EventType
    }

Using this interface, the user can easily add custom gateway events
independently of the library without relying on string maps. This adds a
lot of type safety into the library and makes type-switching on Event
types much more reasonable.

Gateway error callbacks are also almost entirely removed in favor of
custom gateway events. A catch-all can easily be added like this:

    s.AddHandler(func(err error) {
        log.Println("gateway error:, err")
    })
2021-12-14 13:49:34 -08:00
diamondburned 07a2c407e0
discord: Fix incorrect Min/Max fields in command.go 2021-12-02 13:21:47 -08:00
diamondburned 172d448e74
discord: Add {Min,Max} into {Integer,Number}Option 2021-12-01 12:11:59 -08:00
diamondburned 8d78221de0
discord: Improve union interface documentation; fix *Option JSON 2021-11-25 15:02:24 -08:00
Samuel Hernandez c3b7383b77 discord: Add helper functions for creating commands and options 2021-11-18 15:15:03 -08:00
Samuel Hernandez 9edf2f9565 discord: Remove Choice types except for String, Integer, and Number
Choices are only valid for StringOptions, IntegerOptions, and
NumberOptions, so get rid of the invalid fields.
2021-11-18 15:15:03 -08:00
diamondburned e6be4a3fab
discord: Minor comment tweaks 2021-11-16 14:36:07 -08:00