Synchronize muted channel state
This commit is contained in:
committed by
Brandon McGinty
parent
118799d112
commit
20c6997ab0
@@ -123,7 +123,9 @@ func (b *Barnard) OnConnect(e *gumble.ConnectEvent) {
|
||||
b.Client = e.Client
|
||||
|
||||
// Reset muted channels state on connect
|
||||
b.MutedChannelsMutex.Lock()
|
||||
b.MutedChannels = make(map[uint32]bool)
|
||||
b.MutedChannelsMutex.Unlock()
|
||||
b.userChannels = make(map[uint32]*gumble.Channel)
|
||||
b.RecordingMutex.Lock()
|
||||
b.recordingAllowed = nil
|
||||
@@ -279,7 +281,7 @@ func (b *Barnard) OnUserChange(e *gumble.UserChangeEvent) {
|
||||
// Check if user is joining a muted channel
|
||||
if e.Type.Has(gumble.UserChangeConnected) || e.Type.Has(gumble.UserChangeChannel) {
|
||||
// If the channel is muted, ensure the user is muted
|
||||
if b.MutedChannels[e.User.Channel.ID] {
|
||||
if b.isChannelMuted(e.User.Channel.ID) {
|
||||
// Only mute if not already muted
|
||||
if !e.User.LocallyMuted() {
|
||||
b.UserConfig.ToggleMute(e.User)
|
||||
|
||||
Reference in New Issue
Block a user