Commit f1f1938da5

f1f1938da5955ca165dcd905468f02a2909b8cc6

parent: d4c9b2a492

Unsigned

Vedant Deshmukh <73630434+Vedant9500@users.noreply.github.com> · 2024-12-18 15:53 UTC

The FormatTime function has been updated to use minutes if episode length is less than one hour

Layout: unified · split

internal/discord.go +6 −4
@@ -28,12 +28,10 @@ func DiscordPresence(clientId string, anime Anime, IsPaused bool) error {
2828 err = client.SetActivity(client.Activity{
2929 Details: fmt.Sprintf("%s", GetAnimeName(anime)), // Large text
3030 LargeImage: anime.CoverImage,
31 LargeText: GetAnimeName(anime), // Displays while hovering over the large image
31 LargeText: GetAnimeName(anime), // Would display while hovering over the large image
3232 State: state,
33
3433 //SmallImage: anime.SmallCoverImage, // Image for the bottom left corner
3534 //SmallText: fmt.Sprintf("Episode: %s", anime.Ep.Title.English), // Text when hovering over the small image
36
3735 Buttons: []*client.Button{
3836 &client.Button{
3937 Label: "View on AniList", // Button label
@@ -55,5 +53,9 @@ func FormatTime(seconds int) string {
5553 hours := seconds / 3600
5654 minutes := (seconds % 3600) / 60
5755 remainingSeconds := seconds % 60
58 return fmt.Sprintf("%d:%02d:%02d", hours, minutes, remainingSeconds)
56
57 if hours > 0 {
58 return fmt.Sprintf("%d:%02d:%02d", hours, minutes, remainingSeconds)
59 }
60 return fmt.Sprintf("%d:%02d", minutes, remainingSeconds)
5961}