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" {
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 {
log.Println(err.Error())
return

View File

@ -10,11 +10,17 @@ type MatrixWebhook struct {
type MastodonEvent struct {
Event string `json:"event"`
Object struct {
ID string `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
IP string `json:"ip"`
Notes string `json:"invite_request"`
ID string `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
IP string `json:"ip"`
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 {
ID string `json:"id"`
Username string `json:"username"`