Skip to content

Commit

Permalink
Fix GuildSoundboardSoundsUpdate payload
Browse files Browse the repository at this point in the history
  • Loading branch information
sebm253 committed Oct 13, 2024
1 parent 1c388db commit 417678a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions events/guild_soundboard_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type GuildSoundboardSoundDelete struct {
type GuildSoundboardSoundsUpdate struct {
*GenericEvent
SoundboardSounds []discord.SoundboardSound
GuildID snowflake.ID
}

// SoundboardSounds is a response to gateway.OpcodeRequestSoundboardSounds
Expand Down
5 changes: 4 additions & 1 deletion gateway/gateway_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,10 @@ type EventGuildSoundboardSoundDelete struct {
func (EventGuildSoundboardSoundDelete) messageData() {}
func (EventGuildSoundboardSoundDelete) eventData() {}

type EventGuildSoundboardSoundsUpdate []discord.SoundboardSound
type EventGuildSoundboardSoundsUpdate struct {
SoundboardSounds []discord.SoundboardSound `json:"soundboard_sounds"`
GuildID snowflake.ID `json:"guild_id"`
}

func (EventGuildSoundboardSoundsUpdate) messageData() {}
func (EventGuildSoundboardSoundsUpdate) eventData() {}
Expand Down
5 changes: 3 additions & 2 deletions handlers/guild_soundboard_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ func gatewayHandlerGuildSoundboardSoundDelete(client bot.Client, sequenceNumber
}

func gatewayHandlerGuildSoundboardSoundsUpdate(client bot.Client, sequenceNumber int, shardID int, event gateway.EventGuildSoundboardSoundsUpdate) {
for _, sound := range event {
for _, sound := range event.SoundboardSounds {
client.Caches().AddGuildSoundboardSound(sound)
}

client.EventManager().DispatchEvent(&events.GuildSoundboardSoundsUpdate{
GenericEvent: events.NewGenericEvent(client, sequenceNumber, shardID),
SoundboardSounds: event,
SoundboardSounds: event.SoundboardSounds,
GuildID: event.GuildID,
})
}

Expand Down

0 comments on commit 417678a

Please sign in to comment.