discordBots/cmd/domaincheckbot/config/domain.go
2024-07-15 19:39:14 +00:00

30 lines
476 B
Go

package config
import (
_ "embed"
"encoding/json"
"log"
"slices"
)
//go:embed domain.json
var domainsFiles []byte
var Domains map[string][]string
func init() {
err := json.Unmarshal(domainsFiles, &Domains)
if err != nil {
log.Fatal(err)
}
}
func AddDomain(domain, tld string) {
if _, ok := Domains[domain]; ok {
if !slices.Contains(Domains[domain], tld) {
Domains[domain] = append(Domains[domain], tld)
}
} else {
Domains[domain] = []string{tld}
}
}