mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-05-06 05:26:33 -05:00
Logging: Support URL in webhook author object
This commit is contained in:
parent
8260fcf584
commit
4efc2f1231
|
|
@ -17,15 +17,22 @@ func contains(slice []string, item string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
type WebhookAuthorConfig struct {
|
||||
Name string `xml:",chardata"`
|
||||
URL string `xml:"url,attr,omitempty"`
|
||||
}
|
||||
|
||||
type WebhookConfig struct {
|
||||
Enabled bool `xml:"enabled"`
|
||||
URL string `xml:"url"`
|
||||
Author string `xml:"author,omitempty"`
|
||||
EventTypes []string `xml:"eventTypes>event"`
|
||||
Enabled bool `xml:"enabled"`
|
||||
URL string `xml:"url"`
|
||||
// e.g. <author url="https://example.com">Author Name</author>
|
||||
Author WebhookAuthorConfig `xml:"author,omitempty"`
|
||||
EventTypes []string `xml:"eventTypes>event"`
|
||||
}
|
||||
|
||||
type webhookAuthor struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
type webhookEmbed struct {
|
||||
|
|
@ -59,8 +66,8 @@ func (w WebhookConfig) ReportEvent(eventType string, eventData map[string]any) {
|
|||
Title: "> **" + eventType + "**",
|
||||
}
|
||||
|
||||
if w.Author != "" {
|
||||
embed.Author = webhookAuthor{Name: w.Author}
|
||||
if w.Author.Name != "" {
|
||||
embed.Author = webhookAuthor{Name: w.Author.Name, URL: w.Author.URL}
|
||||
}
|
||||
|
||||
for key, value := range eventData {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user