phoneassistant/assistant/assistant.go
Elizabeth Hunt 4b55a71d23
Some checks failed
continuous-integration/drone/push Build is failing
fix assistant
2025-01-13 21:39:54 -08:00

23 lines
440 B
Go

package assistant
import (
"fmt"
"net/http"
"os"
)
func UnlockDoor(webhook string) error {
res, err := http.Get(webhook)
if err != nil || res.StatusCode/100 != 2 {
return fmt.Errorf("got err sending message send req %s %v %s", message, res, err)
}
return nil
}
func Do(command string) error {
if command == "unlock" {
return UnlockDoor(os.Getenv("UNLOCK_DOOR_WEBHOOK"))
}
return fmt.Errorf("unknown command %s", command)
}