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:
@@ -2,13 +2,11 @@ package app
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"vrc_osc_go/internal/config"
|
||||
"vrc_osc_go/internal/osc"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -25,31 +23,32 @@ func startSelfMonitor(cfg *config.Config, state *discordMuteState) {
|
||||
for {
|
||||
path, err := findLatestVrchatLog()
|
||||
if err != nil {
|
||||
time.Sleep(2 * time.Second)
|
||||
time.Sleep(currentGUIRefreshInterval())
|
||||
continue
|
||||
}
|
||||
text, err := os.ReadFile(path)
|
||||
text, err := readFileTail(path, vrchatLogTailBytes)
|
||||
if err != nil {
|
||||
time.Sleep(2 * time.Second)
|
||||
time.Sleep(currentGUIRefreshInterval())
|
||||
continue
|
||||
}
|
||||
nextState := extractLatestSelfLogState(string(text), cfg.VrcLog.SelfName)
|
||||
liveCfg := cfg
|
||||
if loaded, err := config.Load(""); err == nil && loaded != nil {
|
||||
liveCfg = loaded
|
||||
}
|
||||
nextState := extractLatestSelfLogState(DecodeVRChatLog(text), liveCfg.VrcLog.SelfName)
|
||||
if nextState != "" && nextState != lastState {
|
||||
if nextState == "joined" {
|
||||
if err := handleDiscordSend(state, []osc.Value{{Type: 'T', Bool: true}}); err != nil {
|
||||
log.Printf("self monitor discord mute failed: %v", err)
|
||||
if nextState == "left" && liveCfg.GUI.AutoUnmuteOnSelfLeave {
|
||||
if err := unmuteDiscordIfMuted(state, "self_leave"); err != nil {
|
||||
log.Printf("self monitor discord unmute failed: %v", err)
|
||||
SetDiscordSource("self_monitor_error")
|
||||
}
|
||||
} else if nextState == "left" {
|
||||
if err := handleDiscordSend(state, []osc.Value{{Type: 'F', Bool: false}}); err != nil {
|
||||
log.Printf("self monitor discord mute failed: %v", err)
|
||||
SetDiscordSource("self_monitor_error")
|
||||
}
|
||||
log.Printf("self monitor detected leave; auto unmute disabled")
|
||||
}
|
||||
SetDiscordSource("self_monitor")
|
||||
lastState = nextState
|
||||
}
|
||||
time.Sleep(2 * time.Second)
|
||||
time.Sleep(guiRefreshIntervalFromConfig(liveCfg))
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user