Skip to content

Commit

Permalink
Merge pull request #59 from Wraient/dev
Browse files Browse the repository at this point in the history
Discord RPC CoverImage Fix
  • Loading branch information
alvarorichard authored Nov 4, 2024
2 parents d3073bc + a9d2086 commit f1f4220
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
7 changes: 0 additions & 7 deletions internal/api/anime.go
Original file line number Diff line number Diff line change
Expand Up @@ -1203,13 +1203,6 @@ func FetchAnimeDetails(anime *Anime) error {
return errors.New("cover image URL not found")
}

anime.ImageURL = imageURL
err = downloadMedia(imageURL, "cover")
if err != nil {
return errors.Wrap(err, "failed to download cover image")
}

log.Printf("Cover image URL set for anime: %s", anime.Name)
return nil
}

Expand Down
26 changes: 14 additions & 12 deletions internal/api/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,21 @@ func DiscordPresence(clientId string, anime Anime, isPaused bool) error {

// Set up the activity for Discord Rich Presence without a LargeImage key
activity := client.Activity{
Details: anime.Name,
State: state,
Buttons: []*client.Button{
{
Label: "View Cover Image",
Url: anime.ImageURL, // Link to the cover image
Details: anime.Name,
LargeImage: anime.ImageURL,
LargeText: anime.Name,
State: state,
Buttons: []*client.Button{
{
Label: "View on AniList",
Url: fmt.Sprintf("https://anilist.co/anime/%d", anime.AnilistID),
},
{
Label: "View on MAL", // Button label
Url: fmt.Sprintf("https://myanimelist.net/anime/%d", anime.MalID), // Button link
},
},
{
Label: "View on AniList",
Url: fmt.Sprintf("https://anilist.co/anime/%d", anime.AnilistID),
},
},
}
}

// Set the activity
err = client.SetActivity(activity)
Expand Down

0 comments on commit f1f4220

Please sign in to comment.