diff options
| author | hachem <im@hachem.wtf> | 2026-08-29 18:24:42 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-29 18:24:42 +0200 |
| commit | fcbbeccaa80c7e120933682b330272a1490c1cf5 (patch) | |
| tree | 11de4610f01a3861f7bbea94da63dd2d070f420a /internal/bot/bot.go | |
| parent | 4806ee7ef95f0f04079856f7753399b7b7aa6330 (diff) | |
refactor: unify mods command with the search
Diffstat (limited to 'internal/bot/bot.go')
| -rw-r--r-- | internal/bot/bot.go | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/internal/bot/bot.go b/internal/bot/bot.go index 48e395b..39fd00b 100644 --- a/internal/bot/bot.go +++ b/internal/bot/bot.go @@ -114,17 +114,21 @@ func checkMods(cfg *config.Config, client *modrinth.Client) report { newCache := config.Cache{} var rep report - for _, slug := range cfg.ModrinthMods { - versions, err := client.GetVersions(slug) + for _, mod := range cfg.ModrinthMods { + if mod.Pinned() { + continue + } + + versions, err := client.GetVersions(mod.Slug) if err != nil { - log.Printf("[Modrinth] failed for %s: %v", slug, err) + log.Printf("[Modrinth] failed for %s: %v", mod.Slug, err) continue } latest := modrinth.LatestVersion(versions) compatible := modrinth.CompatibleVersion(versions, cfg.MinecraftVersion, "") - cached := cache[slug] + cached := cache[mod.Slug] state := config.ModState{} if compatible != nil { @@ -133,15 +137,15 @@ func checkMods(cfg *config.Config, client *modrinth.Client) report { if latest != nil { state.Latest = latest.ID } - newCache[slug] = state + newCache[mod.Slug] = state switch { case compatible == nil: - rep.noCompatible = append(rep.noCompatible, slug) + rep.noCompatible = append(rep.noCompatible, mod.Slug) case cached.Compatible == "": - rep.newlyCompatible = append(rep.newlyCompatible, slug) + rep.newlyCompatible = append(rep.newlyCompatible, mod.Slug) case latest != nil && latest.ID != cached.Latest: - rep.stillCompatibleUpdate = append(rep.stillCompatibleUpdate, slug) + rep.stillCompatibleUpdate = append(rep.stillCompatibleUpdate, mod.Slug) } } |
