add twitch API stuff, add follow/sub/cheer labels

This commit is contained in:
ari melody 2026-07-24 03:54:29 +01:00
parent 8a7210ad56
commit 626540e728
Signed by: ari
GPG key ID: 60B5F0386E3DDB7E
17 changed files with 1143 additions and 3 deletions

36
utils/dotenv/dotenv.go Normal file
View file

@ -0,0 +1,36 @@
package dotenv
import (
"os"
"strings"
)
func LoadEnv() (map[string]string, error) {
data, err := os.ReadFile(".env")
if err != nil { return nil, err }
dataString := string(data)
lines := strings.Split(dataString, "\n")
envars := map[string]string{}
for _, line := range lines {
splits := strings.Split(line, "=")
if len(splits) < 2 { continue }
key := splits[0]
value := splits[1]
if len(value) > 2 && value[0] == '"' && value[len(value) - 1] == '"' {
value = value[1:len(value)-1]
}
envars[key] = value
}
return envars, nil
}
func SafeGet(m map[string]string, k string) string {
value, _ := m[k]
return value
}