discordBots/cmd/domaincheckbot/config/domain.go

31 lines
476 B
Go
Raw Normal View History

package config
import (
_ "embed"
"encoding/json"
2024-07-12 13:51:53 +00:00
"log"
2024-07-15 19:37:06 +00:00
"slices"
)
//go:embed domain.json
var domainsFiles []byte
2024-07-15 19:37:06 +00:00
var Domains map[string][]string
func init() {
err := json.Unmarshal(domainsFiles, &Domains)
if err != nil {
log.Fatal(err)
}
}
2024-07-15 19:37:06 +00:00
func AddDomain(domain, tld string) {
if _, ok := Domains[domain]; ok {
if !slices.Contains(Domains[domain], tld) {
Domains[domain] = append(Domains[domain], tld)
}
2024-07-15 19:37:06 +00:00
} else {
Domains[domain] = []string{tld}
}
}