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

899 commits

Author SHA1 Message Date
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
diamondburned 08a1db0e4a
state: Fix up ReadyEvent 2022-04-01 04:42:55 -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 aee547fa1f
ws: Add RawEvent for debugging 2022-04-01 04:41:22 -07:00
diamondburned fd59b91de1
state: Handle Thread events 2022-04-01 04:40:15 -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
Neo 87be6b09c1 gateway: Added the struct field of the Thread Members Update event. 2022-03-09 11:02:30 -08:00
Sam 23f5771325
gateway: Remove 4003 from fatal close codes (#316)
https://discord.com/developers/docs/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
2022-02-25 05:10:31 -08: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
diamondburned 209e6282b0
api: Add NullImage 2022-02-17 13:05:15 -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
starshines 7727d140a0
gateway: Update CommunicationDisabledUntil in GuildMemberUpdateEvent.UpdateMember (#307) 2022-02-05 15:05:13 -08:00
diamondburned 3fe7fbc24b
discord: Add StickerItem, fix Sticker.TagList 2022-01-29 03:38:10 -08:00
diamondburned 40ff267a74
voice: Example should use JoinChannelAndSpeak 2022-01-18 21:36:58 -08:00
diamondburned c8f72547f7 voice: Refactor and fix up
This commit refactors a lot of voice's internals to be more stable and
handle more edge cases from Discord's voice servers. It should result in
an overall more stable voice connection.

A few helper functions have been added into voice.Session. Some fields
will have been broken and changed to accomodate for the refactor, as
well.

Below are some commits that have been squashed in:

    voice: Fix Speaking() panic on closed
    voice: StopSpeaking should not error out
        The rationale is added as a comment into the Speaking() method.
    voice: Add TestKickedOut
    voice: Fix region change disconnecting
2022-01-18 21:35:55 -08:00
diamondburned a159ba1c52 api: Add RTCRegionID for ModifyChannelData 2022-01-18 21:35:55 -08:00
diamondburned 4fa2363f8a
Revert "voice: Example should use JoinChannelAndSpeak"
This reverts commit 85619b2976. It was
accidentally merged into v3 instead of 238-branch.
2022-01-18 21:28:23 -08:00
diamondburned 85619b2976
voice: Example should use JoinChannelAndSpeak 2022-01-18 18:26:29 -08:00
Juby210 2d3bf2974a
state: Fix decrementing reaction count (#302)
* state: fix updating reaction count in reaction remove event

* move r.Me branch to if
2022-01-17 16:35:49 -08:00
PL Pery 11432e426c
discord: Correct BulkOverwriteGuildCommands parameters (#301) 2022-01-03 13:38:38 -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
diamondburned 82c2b9e840
gateway: Add Event = ws.Event 2021-12-25 15:17:20 -08:00
diamondburned a4611b7ab4
state: Remove redundant token parameter 2021-12-25 15:08:01 -08:00
starshines bc8a2b0cae
discord: Add timeouts (#299) 2021-12-20 15:56:11 -08:00
avdb c2382028df
README: Fix broken links (#298) 2021-12-20 13:57:04 -08:00
diamondburned 4158db8715 state: Ignore state errors in API wrappers
This commit makes it so that all API wrapper methods under state will
ignore errors returned from the cabinet setters. This is because an
intermittent error from the state shouldn't shadow the actual result
from the Discord API.
2021-12-14 13:49:34 -08:00
diamondburned 054f4de0e1 state: Add NewWithIdentifier 2021-12-14 13:49:34 -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 7af6e23569
utils/httputil: Fix build error from previous commit 2021-11-29 12:41:13 -08:00