Skip to content

Commit

Permalink
embed *VoiceServerUpdate & removed logging
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Aug 3, 2021
1 parent 0404ece commit 3fc01f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
16 changes: 8 additions & 8 deletions api/voice_dispatch_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@ package api

// VoiceServerUpdateEvent sent when a guilds voice server is updated
type VoiceServerUpdateEvent struct {
VoiceServerUpdate *VoiceServerUpdate
Disgo Disgo
*VoiceServerUpdate
Disgo Disgo
}

// Guild returns the Guild for this VoiceServerUpdate from the Cache
func (u *VoiceServerUpdateEvent) Guild() *Guild {
return u.Disgo.Cache().Guild(u.VoiceServerUpdate.GuildID)
return u.Disgo.Cache().Guild(u.GuildID)
}

// VoiceStateUpdateEvent sent when someone joins/leaves/moves voice channels
type VoiceStateUpdateEvent struct {
VoiceState *VoiceState
Member *Member `json:"member"`
*VoiceState
Member *Member `json:"member"`
}

// Guild returns the Guild for this VoiceStateUpdate from the Cache
func (u *VoiceStateUpdateEvent) Guild() *Guild {
return u.VoiceState.Disgo.Cache().Guild(u.VoiceState.GuildID)
return u.Disgo.Cache().Guild(u.GuildID)
}

// VoiceChannel returns the VoiceChannel for this VoiceStateUpdate from the Cache
func (u *VoiceStateUpdateEvent) VoiceChannel() *VoiceChannel {
if u.VoiceState.ChannelID == nil {
if u.ChannelID == nil {
return nil
}
return u.VoiceState.Disgo.Cache().VoiceChannel(*u.VoiceState.ChannelID)
return u.Disgo.Cache().VoiceChannel(*u.ChannelID)
}

// VoiceDispatchInterceptor lets you listen to VoiceServerUpdate & VoiceStateUpdate
Expand Down
1 change: 0 additions & 1 deletion internal/entity_builder_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ func (b *EntityBuilderImpl) CreateMember(guildID api.Snowflake, member *api.Memb
func (b *EntityBuilderImpl) CreateVoiceState(guildID api.Snowflake, voiceState *api.VoiceState, updateCache api.CacheStrategy) *api.VoiceState {
voiceState.Disgo = b.Disgo()
voiceState.GuildID = guildID
b.Disgo().Logger().Infof("voiceState: %+v", voiceState)

if updateCache(b.Disgo()) {
return b.Disgo().Cache().CacheVoiceState(voiceState)
Expand Down

0 comments on commit 3fc01f3

Please sign in to comment.