Increate formatting

This commit is contained in:
idanoo 2022-11-20 18:51:49 +13:00
parent fc1a9882f9
commit 57c8293e87
Signed by: idanoo
GPG Key ID: 387387CDBC02F132

View File

@ -74,7 +74,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
country := ipLookup(i.Object.IP) country := ipLookup(i.Object.IP)
err = sendWebhook( err = sendWebhook(
fmt.Sprintf( fmt.Sprintf(
"New Signup%s: %s (%s) has signed up.\n%s\n%s", "New Signup%s: %s (%s). %s. %s",
country, country,
i.Object.Username, i.Object.Username,
i.Object.Email, i.Object.Email,
@ -98,8 +98,7 @@ func handler(w http.ResponseWriter, r *http.Request) {
// sendWebhook - takes msg, sends to matrix // sendWebhook - takes msg, sends to matrix
func sendWebhook(msgText string) error { func sendWebhook(msgText string) error {
log.Println(msgText) // log.Println(msgText)
data := MatrixWebhook{ data := MatrixWebhook{
Key: MATRIX_WEBHOOK_API_KEY, Key: MATRIX_WEBHOOK_API_KEY,
} }
@ -109,7 +108,7 @@ func sendWebhook(msgText string) error {
return err return err
} }
log.Printf("Sending %s to %s", b, MATRIX_WEBHOOK_URL+"/"+MATRIX_CHANNEL) // log.Printf("Sending %s to %s", b, MATRIX_WEBHOOK_URL+"/"+MATRIX_CHANNEL)
req, err := http.NewRequest("POST", MATRIX_WEBHOOK_URL+"/"+MATRIX_CHANNEL, bytes.NewBuffer(b)) req, err := http.NewRequest("POST", MATRIX_WEBHOOK_URL+"/"+MATRIX_CHANNEL, bytes.NewBuffer(b))
if err != nil { if err != nil {
return err return err