url in discord message

This commit is contained in:
2026-01-20 01:12:17 +01:00
parent b22e72c28f
commit 8f51e6d981
6 changed files with 34 additions and 16 deletions

View File

@@ -19,7 +19,7 @@ type RedmineFetcher struct {
Cache *Cache
}
func (f RedmineFetcher) Fetch() []string {
func (f RedmineFetcher) Fetch() []Entry {
redmineURL := fmt.Sprintf("%s/issues.json", f.BaseURL)
req, _ := http.NewRequest("GET", redmineURL, nil)
req.Header.Set("X-Redmine-API-Key", f.Key)
@@ -27,17 +27,20 @@ func (f RedmineFetcher) Fetch() []string {
var r RedmineResponse
if err := getJSON(req, &r); err != nil {
return []string{}
return []Entry{}
}
if len(r.Issues) == 0 {
return []string{}
return []Entry{}
}
i := r.Issues[0]
if f.Cache.TryUpdate("redmine", i.UpdatedOn) {
url := fmt.Sprintf("%s/issues/%d", f.BaseURL, i.ID)
return []string{fmt.Sprintf("🎫 [Redmine] - #%d %s - %s", i.ID, i.Subject, url)}
return []Entry{{
Title: fmt.Sprintf("🎫 [Redmine] - #%d %s", i.ID, i.Subject),
URL: url,
}}
}
return []string{}
return []Entry{}
}