Skip to content

Commit

Permalink
feat: add achievement count to output
Browse files Browse the repository at this point in the history
  • Loading branch information
surskitt committed Feb 2, 2024
1 parent 9a10b31 commit 4890b88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion steam.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,11 @@ func steamLastAchievement(apiKey, user string, client *http.Client) (string, err
}

game, newest := newestAchievement(achievementsMap)
count := getAchievementCount(game)

if newest.UnlockTime == 0 {
return fmt.Sprintf("%s has no recently unlocked steam achievements", user), nil
}

return fmt.Sprintf("%s's last steam achievement: %s - %s (%s)", user, game.PlayerStats.GameName, newest.Name, newest.Description), nil
return fmt.Sprintf("%s's last steam achievement: %s - %s (%s) (%s)", user, game.PlayerStats.GameName, newest.Name, newest.Description, count), nil
}
2 changes: 1 addition & 1 deletion steam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func TestSteamLastAchievement(t *testing.T) {
{
name: "achievements found",
testFiles: [3]string{"id_found.json", "one_game.json", "achievements.json"},
out: "id's last steam achievement: SUPERHOT: MIND CONTROL DELETE - MORE ()",
out: "id's last steam achievement: SUPERHOT: MIND CONTROL DELETE - MORE () ({yellow}1/14{clear})",
errMsg: "",
},
}
Expand Down

0 comments on commit 4890b88

Please sign in to comment.