Skip to content

Commit ff1f927

Browse files
committed
Relax the DISCORD_WEBHOOK requirements, it can be any URL.
and if it does not match the discord regex it prints a warning but lets things go ahead, this is handy for debugging and canary subdomains of discord. H/T to Tom Bowditch who discovered the latter part
1 parent 462a419 commit ff1f927

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"io/ioutil"
99
"log"
1010
"net/http"
11+
"net/url"
1112
"os"
1213
"regexp"
1314
"strings"
@@ -86,9 +87,14 @@ func main() {
8687
*listenAddress = defaultListenAddress
8788
}
8889

90+
_, err := url.Parse(*whURL)
91+
if err != nil {
92+
log.Fatalf("The Discord WebHook URL doesn't seem to be a valid URL.")
93+
}
94+
8995
re := regexp.MustCompile(`https://discord(?:app)?.com/api/webhooks/[0-9]{18}/[a-zA-Z0-9_-]+`)
9096
if ok := re.Match([]byte(*whURL)); !ok {
91-
log.Fatalf("The Discord WebHook URL doesn't seem to be valid.")
97+
log.Printf("The Discord WebHook URL doesn't seem to be valid.")
9298
}
9399

94100
log.Printf("Listening on: %s", *listenAddress)

0 commit comments

Comments
 (0)