Add report stuff

This commit is contained in:
idanoo 2022-11-20 19:09:08 +13:00
parent 33d7f4ee7d
commit 43e6cab6a6
Signed by: idanoo
GPG Key ID: 387387CDBC02F132
2 changed files with 26 additions and 6 deletions

16
main.go
View File

@ -65,7 +65,21 @@ func handler(w http.ResponseWriter, r *http.Request) {
} }
if i.Event == "report.created" { if i.Event == "report.created" {
err = sendWebhook("New report!") err = sendWebhook(
fmt.Sprintf(
"[New Report](%s): %s has reported %s for %s",
fmt.Sprintf(
"https://mastodon.nz/admin/reports/%s",
i.Object.ID,
),
i.Object.Account.Username,
i.Object.TargetAccount.Username,
fmt.Sprintf(
"Comments: %s",
i.Object.Comment,
),
),
)
if err != nil { if err != nil {
log.Println(err.Error()) log.Println(err.Error())
return return

View File

@ -15,6 +15,12 @@ type MastodonEvent struct {
Email string `json:"email"` Email string `json:"email"`
IP string `json:"ip"` IP string `json:"ip"`
Notes string `json:"invite_request"` Notes string `json:"invite_request"`
Comment string `json:"comment"`
Account struct {
ID string `json:"id"`
Username string `json:"username"`
Domain interface{} `json:"domain"`
} `json:"account"`
TargetAccount struct { TargetAccount struct {
ID string `json:"id"` ID string `json:"id"`
Username string `json:"username"` Username string `json:"username"`