1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-16 03:44:26 +00:00
Commit graph

1032 commits

Author SHA1 Message Date
diamondburned accb2fc52b
example/undeleter: Fix AddSyncHandler 2021-11-03 15:43:07 -07:00
diamondburned 477695f2e6
readme: Fix build badge 2021-11-03 15:42:37 -07:00
diamondburned 0d13edc8fd
gateway: Add ClientState and Capabilities for Identify
This commit preps the gateway for user account usage.
2021-11-03 15:29:29 -07:00
diamondburned efde3f4ea6
state, handler: Refactor state storage and sync handlers
This commit refactors a lot of packages.

It refactors the handler package, removing the Synchronous field and
replacing it the AddSyncHandler API, which allows each handler to
control whether or not it should be ran synchronously independent of
other handlers. This is useful for libraries that need to guarantee the
incoming order of events.

It also refactors the store interfaces to accept more interfaces. This
is to make the API more consistent as well as reducing potential useless
copies. The public-facing state API should still be the same, so this
change will mostly concern users with their own store implementations.

Several miscellaneous functions (such as a few in package gateway) were
modified to be more suitable to other packages, but those functions
should rarely ever be used, anyway.

Several tests are also fixed within this commit, namely fixing state's
intents bug.
2021-11-03 15:16:02 -07:00
diamondburned 7f4daccd2d
shard: Separate state's cabinet, fix return bugs
This commit makes it so that all sharded state.State instances will have
its own cabinet store on construction. This ensures that when a State is
reconnected, a Ready event won't wipe the cabinet for all other states.

This commit also fixes a bug with the Shard() and FromGuildID() getters.
2021-10-31 13:10:34 -07:00
diamondburned e8131db8df
discord: Add VoiceState.SelfVideo; fixes #287 2021-10-30 16:43:28 -07:00
Maximilian von Lindern 528281b739
gateway: Fix Context overwrite in Gateway.Open (#285)
* Gateway: Fix Gateway.Open overwriting the context argument

* WSUtil: Remove max context timeout in Websocket.Dial

* WSUtil: Use Websocket.Timeout if a no-deadline context is given to .Dial

* WSUtil: Add doc to Websocket.Timeout clarifying that it must not be changed after use
2021-10-20 15:06:06 -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
diamondburned 95231f5772
CI: Update dismock 2021-09-23 22:28:02 -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
Maximilian von Lindern 5d2d39d422
gateway: Fix typo in GuildEmojisUpdateEvent.Emojis JSON tag (#276) 2021-09-22 10:57:14 -07:00
diamondburned b2e852d140
bot: Fix previous breaking change 2021-09-22 10:56:40 -07:00
diamondburned 76c25835b7
bot: Move bot to utils 2021-09-18 00:39:34 -07:00
diamondburned 76ec9cd43d discord: Fix InteractionOption.String 2021-09-09 21:12:22 -07:00
samhza 4023a58f67
gateway: Change type of IdentifyData.Intents to option.Uint (#275) 2021-09-09 18:45:08 -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
Maximilian von Lindern f334491dee
api: Mutate validated embeds from discord.Embed.Validate (#271) 2021-08-24 11:23:49 -07:00
rigormorrtiss 1e9eb4a473
api: *Client.ActiveThreads returns ActiveThreads struct (#270)
* v3: api: *Client.ActiveThreads returns ActiveThread struct

* Apply suggestions
2021-08-20 02:27:53 -07:00
diamondburned 64bd519156 state: Store Threads as channels 2021-08-19 20:58:38 -07:00
Maximilian von Lindern b61179d188 api: Remove Client.Kick and rename .KickWithReason to .Kick 2021-08-18 11:31:16 -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
diamondburned fe1f7aa201 CI: Increase testing time 2021-08-16 19:23:32 -07:00
Maximilian von Lindern 525e8d527b api: More multiple embed support for send functions (#266)
* api: Adapt Client.EditMessage, SendEmbedReply, and SendMessageReply to take in
  multiple embeds

* api: Fix incorrect use of Client.EditMessage

* api: Make EditMessage omit empty content or embeds from payload
2021-08-16 02:26:25 -07:00
Maximilian von Lindern 19335e5050 api: Pointerize return types for consistency
Pointerize Client.Command, .GuildCommand, .CommandPermissions, and .EditCommandPermissions for consistency
2021-08-15 12:29:30 -07:00
Maximilian von Lindern 244570c280
api: Add support for the X-Audit-Log-Reason header (#259)
* api: add support for the X-Audit-Log-Reason header

* api: inline reason parameter, where data struct has a single field
2021-08-15 18:33:33 +02:00
Nat dbfc49fb08
API: Fix Client.{Guild,}Command() (#264) 2021-08-14 22:27:22 -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
bumbread 3753794fad readme: Fix non-compiling example (#258) 2021-08-08 15:02:35 -07:00
diamondburned b1cae78096 bot: Stop message handling on middleware errors 2021-08-08 13:53:24 -07:00
Maximilian von Lindern 955bb2aad2
api: Make some InteractionResponseData fields nullable (#256)
* api: make InteractionResponseData.Content, .Embeds, and .Components nullable

* Fix examples

* Remove test code

* fix commands example
2021-08-08 13:20:54 -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
Hamza Ali 0d7774bd6a
gateway: Skip unknown events while reconnecting (#255)
This change skips events that are unknown while the bot reconnects. This
is an event that is particularly rare as it requires unimplemented
events being called in the time before a bot's HELLO -> RESUME events
are called. This change explicitly returns unknown events as a special
time defined in wsutil/op.go and ignores them from reaching gateway/op.go
2021-08-03 18:00:31 -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
Starshine System 42aa73a592 gateway: change InteractionOption.Value to json.Raw, add helper methods 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
EvieDelta 29a3094a75
gateway: Possible Close/Send deadlock bug (#244)
when websocket send error happens in wsutil.(Websocket).SendCtx

Co-authored-by: EvieDelta <no public email>
2021-07-11 10:56:18 -07:00
diamondburned af35c03b8e voice: Fix race condition, see #237 2021-06-30 00:19:30 -07:00
diamondburned d4c66d4971 api: Omitted SearchData redundant option type 2021-06-26 17:04:00 -07:00