url in discord message
This commit is contained in:
@@ -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{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user