mirror of
https://github.com/idanoo/go-mastodon-matrix-webhooks.git
synced 2024-11-22 08:25:17 +00:00
Increate formatting
This commit is contained in:
parent
fc1a9882f9
commit
57c8293e87
9
main.go
9
main.go
@ -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
|
||||||
@ -145,5 +144,5 @@ func ipLookup(ip string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
return " from" + results.Country_long
|
return " from " + results.Country_long
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user