mirror of
https://github.com/idanoo/go-mastodon-matrix-webhooks.git
synced 2024-11-21 08:01:58 +00:00
Add report stuff
This commit is contained in:
parent
33d7f4ee7d
commit
43e6cab6a6
16
main.go
16
main.go
@ -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
|
||||
|
16
structs.go
16
structs.go
@ -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"`
|
||||
|
Loading…
Reference in New Issue
Block a user