Revert "remove double entries in telegram report message"
This reverts commit e4db93e911
.
This commit is contained in:
parent
e4db93e911
commit
c46d395f3f
@ -102,8 +102,6 @@ func sendTelegramAnimeEpMessage(animeEpisodes []model.AnimeEpisode) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
animeEpisodes = RemoveDoubleEntries(animeEpisodes)
|
|
||||||
|
|
||||||
b := new(strings.Builder)
|
b := new(strings.Builder)
|
||||||
if err := TelegramOrganizeMessagePattern.Execute(b, animeEpisodes); err != nil {
|
if err := TelegramOrganizeMessagePattern.Execute(b, animeEpisodes); err != nil {
|
||||||
adverr.Println(adverr.Wrap("could not send telegram message", err))
|
adverr.Println(adverr.Wrap("could not send telegram message", err))
|
||||||
|
15
utils.go
15
utils.go
@ -6,11 +6,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.milar.in/milarin/anilist"
|
|
||||||
"git.milar.in/milarin/channel"
|
"git.milar.in/milarin/channel"
|
||||||
"git.milar.in/milarin/gmath"
|
"git.milar.in/milarin/gmath"
|
||||||
"git.milar.in/milarin/slices"
|
|
||||||
"git.milar.in/nyaanime/model"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func InitializeRunner() channel.Runner {
|
func InitializeRunner() channel.Runner {
|
||||||
@ -66,15 +63,3 @@ func WaitForNextTelegramSendCycle() {
|
|||||||
time.Sleep(time.Until(nextCycle))
|
time.Sleep(time.Until(nextCycle))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func RemoveDoubleEntries(animeEpisodes []model.AnimeEpisode) []model.AnimeEpisode {
|
|
||||||
mapperFunc := func(animeEp model.AnimeEpisode) (anilist.MediaID, model.AnimeEpisode) {
|
|
||||||
return animeEp.Anime.ID, animeEp
|
|
||||||
}
|
|
||||||
|
|
||||||
unmapperFunc := func(id anilist.MediaID, animeEp model.AnimeEpisode) model.AnimeEpisode {
|
|
||||||
return animeEp
|
|
||||||
}
|
|
||||||
|
|
||||||
return slices.OfMap(slices.ToMap(animeEpisodes, mapperFunc), unmapperFunc)
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user