mirror of
https://github.com/idanoo/go-mastodon-matrix-webhooks
synced 2025-07-04 04:22:14 +00:00
Increate formatting
This commit is contained in:
parent
fc1a9882f9
commit
57c8293e87
1 changed files with 4 additions and 5 deletions
7
main.go
7
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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue