1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-01 12:34:28 +00:00
Commit graph

274 commits

Author SHA1 Message Date
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
Tadeo Kondrak 2ec0e6b011
discord: Use json.Unmarshal instead for CommandInteractionOption (#292)
This ensures valid JSON strings are processed using the JSON rules, not
the Go rules.
2021-11-13 15:18:52 -08:00
Tadeo Kondrak c98e2f8730 discord: Add Options field to AutocompleteOption
This is used for subcommands.
2021-11-13 13:45:26 -08:00
diamondburned 331ec59dec discord: Refactor interactions and components
This commit gets rid of contain-it-all structs and instead opt for
interface union types containing underlying concrete types with no
overloading.

The code is much more verbose by doing this, but the API is much nicer
to use. The only disadvantage in that regard is the interface assertion
being too verbose and risky for users at times.
2021-11-12 11:38:36 -08:00
Hamza Ali 6fba21d704
api: Implement autocomplete components 2021-11-09 14:49:21 -08:00
diamondburned e8131db8df
discord: Add VoiceState.SelfVideo; fixes #287 2021-10-30 16:43:28 -07:00
Nat 918cce64e9
discord: Fix json tag for Guild.Features (#283) 2021-10-04 23:22:27 -07:00
samhza bfb644c124
api: Add CurrentApplication (#282)
* discord/api: support fetching bot's Application

* Update api/application.go

Co-authored-by: diamondburned <diamond@arikawa-hi.me>

Co-authored-by: diamondburned <diamond@arikawa-hi.me>
2021-10-03 13:31:48 -07:00
starshines 8ea320ccb9
discord: Add ChannelType field to CommandOption (#279)
* discord: add ChannelType field to CommandOption

* preallocate option.ChannelTypes

Co-authored-by: diamondburned <diamond@arikawa-hi.me>

Co-authored-by: diamondburned <diamond@arikawa-hi.me>
2021-09-28 14:12:04 -07:00
starshines ca70e0cca9
discord: Add per-guild avatars, ModifyMe -> ModifyCurrentUser (#278)
* v3: discord, api, gateway: add per-guild avatars

* api: rename ModifyMe to ModifyCurrentUser
2021-09-28 11:46:36 -07:00
samhza e203e31ab3
discord: Update to match current API docs (#277)
* discord: update permission constants

* discord: update MessageType constants, add ephemeral field to Attachment

Renamed ApplicationCommandMessage to ChatInputCommandMessage and add
ContextMenuCommand. Add the ephemeral field to Attachment.

* discord: add version field to Command

* gateway: remove ApplicationCommandUpdateEvent

52f1824451
2021-09-23 21:37:50 -07:00
diamondburned 76ec9cd43d discord: Fix InteractionOption.String 2021-09-09 21:12:22 -07:00
samhza dc92845315
discord: move Interaction over; update api.CommandCreateData (#274)
- Moved gateway.InteractionCreateData to discord.Interaction, now
gateway.InteractionCreateData is a struct that wraps
discord.Interaction.
- Split InteractionData into CommandInteractionData and
ComponentInteractionData.
- Renamed ButtonInteraction to ComponentInteraction.
- Updated api.CommandCreateData to add new fields.
- Update Component types' Type() methods to pointer receivers.
2021-09-09 16:06:44 -07:00
Maximilian von Lindern 02712516e3 discord: Change type of SelectComponent.MinValues to option.Int 2021-08-30 13:23:43 -07:00
Maximilian von Lindern 53c72c1e16 option: Move conflicting types into package discord 2021-08-30 13:23:43 -07:00
Maximilian von Lindern 2647267460
discord: Fix style issues (#272)
* Discord: Fix comment style issues

* Discord: use URL type alias for URls instead of string
2021-08-30 13:15:59 -07:00
rigormorrtiss eece98903a
discord: Add Banner & Accent fields to User (#267)
* feat(discord): add banner & accent_color field to User struct

* feat(discord): use type Color (uint32) for User.AccentColor

* discord: change field name to Accent
2021-08-16 23:48:36 -07:00
rigormorrtiss b253a5659b
discord: Add Invitable field for threads (#268) 2021-08-16 22:37:33 -07:00
rigormorrtiss e97dcb750c
discord: Add omitempty option to Attachment.ContentType (#263) 2021-08-12 11:45:48 -07:00
Juby210 21888dcfc2
discord: Add missing ContentType to Attachment (#262) 2021-08-11 18:16:50 -07:00
starshines f7880b91ee
discord: Add select component type (#260) 2021-08-10 14:02:30 -07:00
Maximilian von Lindern c00567599b
api: Threads (#257)
* api/gateway: Implement threads

* discord/api: rename PermissionOverwrites fields to Overwrites

* discord: rename Minutes to ArchiveDuration

* discord: Rename ArchiveDuration constants

Co-authored-by: diamondburned <datutbrus@gmail.com>
2021-08-08 13:19:15 -07:00
Maximilian von Lindern 101fe46313
api: Add missing slash command endpoints (#252)
* api: add missing slash command endpoints
* fix examples
* api: Remove Original prefix from Client.OriginalInteractionResponse,
  EditOriginalResponse, and DeleteOriginalResponse
2021-08-03 11:44:20 -07:00
Starshine System 127c6776ac discord: add missing command option types 2021-08-03 09:07:09 -07:00
rigormorrtiss 2fe1150d01
discord: Update Sticker struct, add missing fields (#251)
* Update Sticker struct & add missing fields

* Remove PreviewAsset field from Sticker

Co-authored-by: Maximilian von Lindern <maximilian.v.lindern@gmail.com>

* Update discord/message.go

Co-authored-by: Maximilian von Lindern <maximilian.v.lindern@gmail.com>

* Change Sticker.User type to *User

Co-authored-by: Maximilian von Lindern <maximilian.v.lindern@gmail.com>

* Update discord/message.go

Co-authored-by: Maximilian von Lindern <maximilian.v.lindern@gmail.com>

* Sticker types start from 0

Co-authored-by: Maximilian von Lindern <maximilian.v.lindern@gmail.com>

* Change Sticker.SortValue type to *int

Co-authored-by: Maximilian von Lindern <maximilian.v.lindern@gmail.com>

* Remove extra space

* Un-ignore Sticker.Tags field

Co-authored-by: Maximilian von Lindern <maximilian.v.lindern@gmail.com>

Co-authored-by: Maximilian von Lindern <maximilian.v.lindern@gmail.com>
2021-08-02 16:16:06 -07:00
Maximilian von Lindern ce4bd67f17
discord: Add missing webhook fields (#250)
* discord: add missing webhook fields
* discord: add missing ,omitempty tags on Webhook
* discord: add missing ,omitempty tags on Webhook
2021-08-02 16:14:34 -07:00
Starshine System 9651328b74
discord: Raise embed description limit to 4096 characters (#243) 2021-07-11 13:19:54 -07:00
samhza 1b12057e51
discord: Make OverboundError.Error() have a pointer receiver (#232) 2021-06-18 00:15:02 -07:00
samhza 37b8871c65
api: Update sending/editing messages for v9 (#230)
api.{Send,Edit}MessageData and their equivalents in package api/webhook
have been updated to add some fields added in Discord API v9.
(webhook.Client).EditMessage now also returns a message, because that
endpoint returns a message on success.
2021-06-17 23:32:11 -07:00
Germano Eichenberg 94090b92ff
discord, gateway: Add IsPending to Member & SupplementalMember (#231) 2021-06-17 13:40:57 -07:00
diamondburned 68313eb872 discord: Fix Channel not unmarshaling 2021-06-14 15:23:08 -07:00
Maximilian von Lindern c8e7eff04e discord: rename ActivityTimestamp to ActivityTimestamps 2021-06-06 13:12:24 -07:00
Maximilian von Lindern f1f4f06979
*: Rename error types to have Error suffix (#215) 2021-06-06 12:40:24 -07:00
Samuel Hernandez 40e1a3757d *: Migrated Go Modules to v3 2021-06-01 19:59:01 -07:00
Maximilian von Lindern c45096c9fa
discord: Fix faulty marshal of Channel.RTCRegionID (#210) 2021-05-30 14:14:41 -07:00
Maximilian von Lindern 5a1837a094 discord/api: Add StageInstances 2021-05-29 22:17:39 -07:00
diamondburned 4595c87e36 discord: Fix {un,}marshal loop 2021-05-29 22:07:39 -07:00
Maximilian von Lindern 6f73088e7d api/discord: Add RTCRegionID and VoiceQuality 2021-05-29 22:07:39 -07:00
diamondburned b936d00ead discord: Minor comment fixes for components 2021-05-29 21:32:38 -07:00
Scott 10c8837000 api: Finalized buttons implementation (#200)
* all: Added Components fields to message-related types
* discord: Documented Reactions field
* discord: Implement fix for Component
* gateway: Added User and Message fields to InteractionCreateEvent
* api: Made InteractionResponseData fields optional for UpdateMessage responses
* api: Deprecated and updated interaction response types
* gateway: Update optional interaction event fields
* discord: Added ComponentWrap for json unmarshalling
* state: Update components on MessageUpdate
* Updated buttons example
2021-05-29 21:32:33 -07:00
unknown a1ab986ded discord: Emoji methods use IsUnicode() 2021-05-29 14:16:44 -07:00
unknown 58fea822e1 discord: Fixed docs links 2021-05-29 14:16:44 -07:00
unknown d69abe49de discord: Add AllVoice perms 2021-05-29 14:16:44 -07:00
unknown f5b3e3972b discord: Use consts for Discord constants 2021-05-29 14:16:44 -07:00
Chan Wen Xu c880cb2fc8 interaction: Implement buttons 2021-05-29 14:16:44 -07:00
unknown f8195f6e87 discord: Add Emoji.IsCustom() & IsUnicode() methods 2021-05-20 22:53:46 -07:00
unknown 25152c85d9 discord: Fixed typo 2021-05-20 22:53:46 -07:00
unknown cfd620ee39 discord: Add User.Tag() method 2021-05-20 22:53:46 -07:00
unknown 5026795551 discord: Add CreatedAt() methods 2021-05-20 22:53:46 -07:00
unknown a10c4d2062 discord: Document User.Mention() 2021-05-20 22:53:46 -07:00
Chan Wen Xu 5b63307a4a discord: Add certified moderator user flag
A new user flag has been documented in discord/discord-api-docs@55cd3d7.
This commit adds the flag to arikawa.
2021-05-20 09:40:21 -07:00
diamondburned 968112fb53 Discord: typed snowflake for Interaction 2021-02-17 17:41:19 -08:00
Matthew Penner 7c3374543e Discord: Add basic support for slash commands 2021-01-27 10:44:14 -08:00
diamondburned afc4183020 Discord: Activity to have AppID instead for consistency
This change is breaking for the discord.Activity struct, but it's worth
having the consistency.
2021-01-27 10:30:09 -08:00
mavolin d940a97a0f Discord: add support for string based OverwriteTypes as used in GuildCreate 2021-01-10 13:29:11 -08:00
diamondburned dcee1c2506 Discord: Fixed MessageType values 2021-01-05 13:38:37 -08:00
diamondburned 3e2814748f Discord: Fixed Sticker rec bug, simpler TagList method 2020-12-19 16:08:28 -08:00