1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-01 04:24:19 +00:00
Commit graph

270 commits

Author SHA1 Message Date
twoscott 2ec439a63f api: Add GET Thread Member method 2024-02-28 17:46:21 -08:00
diamondburned 19518a0844
cmdroute: Implement Router.{With,Group}
This commit implements cmdroute.Router.Group and cmdroute.Router.With,
similar to go-chi's Mux.

Fixes #418
2024-02-06 23:45:48 -08:00
Benbebop 10d3626429
api: Add ID param to CreateCommandData (#417) 2024-01-06 19:17:03 -08:00
diamondburned 093436066e
cmdroute: Fix OverwriteCommands being broken 2023-11-04 01:48:17 -07:00
Cléo Rebert 8f548d2607 go fmt + gci
Signed-off-by: Cléo Rebert <cleo.rebert@gmail.com>
2023-09-19 11:37:24 -07:00
Cléo Rebert d36955acea Move away from github.com/pkg/errors
Signed-off-by: Cléo Rebert <cleo.rebert@gmail.com>
2023-09-19 11:37:24 -07:00
diamondburned 4bc415f72b
cmdroute: Add ev.Data into {Command,Autocomplete}Data
This mostly helps avoid a type assertion that could potentially be
incorrectly done.
2023-08-31 23:42:35 -07:00
diamondburned b1a54c0b41
webhook: Add several abstracted constructors 2023-08-15 00:30:03 -07:00
Simo Aleksandrov 13ac33f33f
api: Add missing query parameter to SearchData (#403) 2023-08-07 12:18:35 -07:00
diamondburned 3cb993aff9
cmdroute: Allow routing ComponentInteraction 2023-08-04 14:14:00 -07:00
diamondburned 2b0395ab12
api: Fix c07f574 broken tests
Closes #395.
2023-06-07 18:03:26 -07:00
diamondburned c07f574558
api: Don't omitempty SendMessageData.Flags
This might fix Discord pings not working. AFAIK Discord might have
changed the defaults which might have broken some of our bots.

Bots that want to set flags should explicitly do so. We're not
supporting Discord's defaults.
2023-05-24 14:25:19 -07:00
ayn2op 9d3f579e90 api: add Flags field to SendMessageData struct 2023-02-11 03:31:13 -08:00
diamondburned 080c734b37
cmdroute: Add OverwriteCommands
This adds a small helper function just for convenience.
2022-12-10 06:02:37 -08:00
Sam Xie 12a84ee999
discord: Add omitempty tag for category id (#357) 2022-11-28 14:54:25 -08:00
diamondburned 181dcb1bdd
api: Introduce api/cmdroute
This commit introduces a slash commands and autocompletion router. It
abstracts the switch-cases that the user has to do in each
InteractionEvent handler away.

The router is largely inspired by go-chi's design. Refer to the tests
for examples.
2022-10-13 23:01:29 -07:00
zBNF e058e7c7b7
api: Allow disabling interaction pubkey verification (#350)
* feat: add support for disabling signature verification

* feat: refactor solution to not break api

* feat: make InteractionServer.ServeHTTP use InteractionServer.httpHandler
2022-10-11 18:01:31 -07:00
Samuel Hernandez 3ae45b7816 api: *ArchivedThreadsBefore to *ArchivedThreads, allow empty Limit 2022-10-01 22:02:28 -07:00
diamondburned 219b1d80d6
api: Fix incorrect use of ArchivedThreads
This commit fixes the several ArchivedThread API getters to unmarshal to
the right type. Prior to this commit, things don't work.
2022-10-01 19:35:41 -07:00
svenwiltink fa35b32b79
discord: Add ChannelFlags (#345)
* added ChannelFlags

* Minor style fixes, comment additions

Co-authored-by: diamondburned <diamond@arikawa-hi.me>
2022-09-23 00:00:04 -07:00
svenwiltink 238a91b2fc
discord: Add Tag for forum (#344)
* Add Tag and TagID for forum capabilities

* set correct json flags

* Fix up naming and minor fixes

Co-authored-by: diamondburned <diamond@arikawa-hi.me>
2022-09-21 13:17:26 -07:00
diamondburned 75ff7342b1
api: Add InteractionHandlerFunc 2022-08-23 13:42:29 -07:00
diamondburned 9e9f90a652
webhook: Add missing Content-Type for Pong 2022-08-22 14:43:49 -07:00
diamondburned 22e8d607ad
api: Fix InteractionServer's writeError 2022-08-22 03:21:12 -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 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 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 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 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
twoscott 33fbc1a1a2 api: Allow all types for api choices 2022-06-05 17:56:52 -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
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
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 30c63e66d1
discord: Ack.Token nullable 2022-04-02 21:55:26 -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
diamondburned 209e6282b0
api: Add NullImage 2022-02-17 13:05:15 -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 a159ba1c52 api: Add RTCRegionID for ModifyChannelData 2022-01-18 21:35:55 -08:00
PL Pery 11432e426c
discord: Correct BulkOverwriteGuildCommands parameters (#301) 2022-01-03 13:38:38 -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 5c88317130
api: Fix CreateInteractionFollowup return 2021-11-23 22:53:27 -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
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 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