1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-07-28 16:32:24 +00:00
Commit graph

278 commits

Author SHA1 Message Date
diamondburned daf47b3491
api: Add upload size consts and DetermineUploadSize
This commit adds a new method `DetermineUploadSize` into both api.Client
and state.State, which implement the core logic to determine the right
upload size limit for the current user. Bots can ignore this method.

This commit also adds constants for the upload size limits, with
different constants for different scenarios (nitro, server boosts).
Bots can directly use the `UploadSizeLimit` constant, which is the
default lowest limit.
2025-06-20 01:25:20 -07:00
ayn2op 7824d15d26 feat(api): add fields to LoginResponse 2025-05-15 10:38:23 -07:00
ayn2op 8a78eb0443 fix(api): change field name to login 2025-04-28 23:05:05 -07:00
twoscott b01afe1b80 api: Support with_counts for Guilds method 2025-03-25 21:49:43 -07:00
hi117 acbed83ca7
api: Add initial implementation for automoderator API (#444)
* Add initial implementation for automoderator api

* Move AutoModerationRuleID to snowflake.go and go generate

* Combine a struct and document all the things

* Add audit log reasons to modify and delete in automoderation

* Update docstrings and change how data is passed in

* Rename plurals to singulars and update data stuff

* fixup

* Update to use optional

* Move params out of data

* fixup and add types
2024-08-06 14:43:41 +07:00
Samuel Hernandez 231b4759dc api: allow searching DMs 2024-07-14 14:46:59 +07:00
diamondburned bc3439b8ff
cmdroute: Further deprecate Handle{Command,Autocompletion}
These functions now call HandleInteraction directly, which then calls
internal functions. For incorrect uses, this change is breaking.
2024-07-06 12:42:00 +07:00
蒟蒻 529272a9a9
cmdroute: Fix Autocompleter handling (#423)
* handle group with cmdroute/autocompleter

* handle autocompleter: find all options
2024-03-18 23:09:44 -07:00
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