Files
yt-dlp-bot/app/state.go
2026-02-10 21:59:30 -05:00

28 lines
657 B
Go

package main
import "sync"
// Global state management
var (
interactionStates = make(map[string]*InteractionState)
interactionStatesMutex = sync.RWMutex{}
)
func getInteractionState(token string) *InteractionState {
interactionStatesMutex.RLock()
defer interactionStatesMutex.RUnlock()
return interactionStates[token]
}
func setInteractionState(token string, state *InteractionState) {
interactionStatesMutex.Lock()
defer interactionStatesMutex.Unlock()
interactionStates[token] = state
}
func deleteInteractionState(token string) {
interactionStatesMutex.Lock()
defer interactionStatesMutex.Unlock()
delete(interactionStates, token)
}