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

60 commits

Author SHA1 Message Date
Samuel Hernandez 65afa699ef gateway: add missing Event suffix to GuildMemberListUpdateEvent 2024-08-04 18:26:28 +07:00
diamondburned f7f228a848
gateway: Add undocumented ConversationSummaryUpdateEvent 2024-01-02 01:35:16 -08:00
ayn2op 55d19000a1
discord: Rename IntentGuildBans; add GuildAuditLogEntryCreateEvent (#370)
* Rename GuildBans intent & add GUILD_AUDIT_LOG_ENTRY_CREATE event

* Add IntentGuildBans constant for backward compatibility
2023-01-27 01:34:50 -08:00
diamondburned 87c479a2dc
gateway: Use PartialUnmarshal for ReadyEventExtras 2022-11-03 02:30:25 -07:00
diamondburned 60ed12f3c0
gateway: Add Ready.SessionID 2022-10-31 04:34:21 -07:00
diamondburned f8d6199e80
gateway: Re-type SessionsReplaceEvent 2022-10-31 04:30:10 -07:00
diamondburned 60bcb4c966
gateway: Add Ready.Sessions 2022-10-31 04:11:45 -07:00
diamondburned 83cf774073
gateway: Separate Ready to ReadyEventExtras
This commit separates the undocumented fields of Ready to
ReadyEventExtras. Realistically, this is never an issue for bots, but it
might cripple non-bot users when Discord makes breaking changes to the
API.

This change allows Ready to still be unmarshaled even when the
undocumented fields cannot be unmarshaled. It also adds a new json.Raw
field that allows the whole Ready event to be unmarshaled differently.

This new ReadyEventExtras is also no longer marshaled as part of Ready.
Instead, none of its field will be present. Although this is a breaking
change, it solely concerns non-bot APIs, so it's acceptable.
2022-10-03 23:18:43 -07:00
diamondburned d952c98829
gateway: Fix RequestGuildMembersCommand.GuildIDs 2022-10-03 04:48:50 -07:00
diamondburned d97492348d
gateway: Fix RequestGuildMembersCommand for empty query 2022-10-03 04:47:04 -07:00
p5nbTgip0r dcfc9b19d1 gateway: Add IsPending for GuildMemberUpdateEvent 2022-08-22 14:43:29 -07:00
diamondburned 4108d10b44
gateway: Fix RequestGuildMembersCommand 2022-04-08 05:47:21 -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 08a1db0e4a
state: Fix up ReadyEvent 2022-04-01 04:42:55 -07:00
Neo 87be6b09c1 gateway: Added the struct field of the Thread Members Update event. 2022-03-09 11:02:30 -08:00
starshines 7727d140a0
gateway: Update CommunicationDisabledUntil in GuildMemberUpdateEvent.UpdateMember (#307) 2022-02-05 15:05:13 -08:00
diamondburned 82c2b9e840
gateway: Add Event = ws.Event 2021-12-25 15:17:20 -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 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
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
Maximilian von Lindern 5d2d39d422
gateway: Fix typo in GuildEmojisUpdateEvent.Emojis JSON tag (#276) 2021-09-22 10:57:14 -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
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
Starshine System 42aa73a592 gateway: change InteractionOption.Value to json.Raw, add helper methods 2021-08-03 09:07:09 -07:00
Samuel Hernandez 40e1a3757d *: Migrated Go Modules to v3 2021-06-01 19:59:01 -07:00
diamondburned 694d6a2bba gateway: Clarify field presence for InteractionCreateEvent 2021-05-29 21:32:35 -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
Chan Wen Xu c880cb2fc8 interaction: Implement buttons 2021-05-29 14:16:44 -07:00
Starshine System 20166f33cc
gateway: fix Joined field in GuildCreateEvent (#193) 2021-04-11 16:56:05 -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 5e2af90fd0 Gateway: Rollback weird user changes 2020-12-01 18:07:42 -08:00
diamondburned a2333996a2 Gateway: Presence to contain user and guild fields
This commit changes the gateway.Presence struct to be similar to commits
prior to the last refactor, that is, the struct would have the User and
GuildID fields. This is done so it's easier to store them.
2020-11-28 22:36:33 -08:00
diamondburned 6ef093eb98 Gateway: Refactor, v8 user struct updates
This commit refactored several structures from package discord to be in
package gateway. Those structures are mostly presence ones, which per
official documentation has a lot more to do with the Gateway API than
the REST API or anything else.

This commit also renamed several global variables to have a more
consistent and obvious name.

As of v8, the user API has had a lot of minor and some major changes,
especially regarding its Ready event API. The most significant change is
the addition of the ReadySupplemental event as well as several changes
to the Ready field itself.

All of these changes above are breaking, and they have already broken
the state package. These breaking changes will be addressed in other
packages by the next commit.
2020-11-28 17:22:03 -08:00
mavolin 88258b51c2 replace usage of discordapp.com with discord.com in docs 2020-11-03 10:14:53 -08:00
diamondburned fd16db1385 Gateway: Fixed MessageReactionRemoveEmoji not having Event suffix 2020-10-28 19:31:43 -07:00
diamondburned 75df94d9f4 *: Migrated Go Modules to v2 2020-10-28 15:39:59 -07:00
diamondburned 8aa60ebf8e *: Removed the Game field
The Activities field should now be used. Access the first element.
2020-10-28 14:01:08 -07:00
diamondburned af7f413cea Gateway: Clarified GuildMemberListGroup.ID docs 2020-08-14 21:13:48 -07:00
Tadeo Kondrak d290b0d01c *: Add typed Snowflake IDs (#122)
This PR closes #120.
2020-07-29 16:58:33 -07:00
diamondburned 9d7f5cb953 Gateway: Deprecated useless type definitions for embedded structs 2020-07-14 21:38:31 -07:00
diamondburned 7572caad31 Discord: Added Relationship API methods; moved structs around 2020-07-14 18:01:24 -07:00
diamondburned edb8a46ef2 Gateway: Added intent helpers and more context API support 2020-07-11 12:50:32 -07:00
diamondburned d3d9811276 Gateway: Added Relationship events and handlers; minor reformatting 2020-07-11 00:02:57 -07:00
diamondburned (Forefront) 64c6ca7916 Gateway: Fixed GuildCreateEvent not having Channels 2020-05-17 22:48:16 -07:00
diamondburned (Forefront) adb23eeb8e Gateway: Added new InviteCreateEvent and InviteDeleteEvent 2020-05-12 17:51:23 -07:00
mavolin f453c1eefa
Gateway: Fix #45 2020-05-12 04:54:16 +02:00