Clean project layout and fix release workflow
Some checks failed
build-windows-exe / build (push) Failing after 1m13s
Some checks failed
build-windows-exe / build (push) Failing after 1m13s
This commit is contained in:
@@ -54,6 +54,41 @@ func handleDiscordSend(state *discordMuteState, args []osc.Value) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func unmuteDiscordIfMuted(state *discordMuteState, source string) error {
|
||||
if state == nil {
|
||||
return fmt.Errorf("discord state is nil")
|
||||
}
|
||||
state.mu.Lock()
|
||||
defer state.mu.Unlock()
|
||||
|
||||
if !state.muted {
|
||||
log.Printf("INFO %s requested Discord unmute but already unmuted", source)
|
||||
SetDiscordAction("already_unmuted")
|
||||
SetDiscordSource(source)
|
||||
return nil
|
||||
}
|
||||
|
||||
now := time.Now()
|
||||
if !state.lastAction.IsZero() && now.Sub(state.lastAction) < discordDebounce {
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Printf("ACTION %s -> Discord unmute hotkey", source)
|
||||
if err := pressDiscordMuteHotkey(); err != nil {
|
||||
log.Printf("discord unmute hotkey failed: %v", err)
|
||||
SetDiscordAction("hotkey_failed")
|
||||
SetDiscordSource(source + "_error")
|
||||
state.lastAction = now
|
||||
return err
|
||||
}
|
||||
state.muted = false
|
||||
state.lastAction = now
|
||||
SetDiscordMuted(false)
|
||||
SetDiscordAction("unmuted")
|
||||
SetDiscordSource(source)
|
||||
return nil
|
||||
}
|
||||
|
||||
func toBool(v osc.Value) (bool, error) {
|
||||
switch v.Type {
|
||||
case 'T':
|
||||
|
||||
Reference in New Issue
Block a user