Skip to content

Commit

Permalink
update import instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
th0mk committed Jan 8, 2025
1 parent 1fe4951 commit 2b7d61b
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 73 deletions.
149 changes: 78 additions & 71 deletions src/FMBot.Bot/Builders/ImportBuilders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,44 +83,40 @@ public async Task<ResponseModel> GetSpotifyImportInstructions(ContextModel conte

response.Embed.WithTitle("Spotify import instructions");

var description = new StringBuilder();
var requestDescription = new StringBuilder();

description.AppendLine("### Requesting your data from Spotify");
description.AppendLine(
requestDescription.AppendLine(
"1. Go to your **[Spotify privacy settings](https://www.spotify.com/us/account/privacy/)**");
description.AppendLine("2. Scroll down to \"Download your data\"");
description.AppendLine("3. Select **Extended streaming history**");
description.AppendLine("4. De-select the other options");
description.AppendLine("5. Press request data");
description.AppendLine("6. Confirm your data request through your email");
description.AppendLine("7. Wait up to 30 days for Spotify to deliver your files");

description.AppendLine("### Importing your data into .fmbot");
description.AppendLine("1. Download the file Spotify provided");

if (context.SlashCommand)
requestDescription.AppendLine("2. Scroll down to \"Download your data\"");
requestDescription.AppendLine("3. Select **Extended streaming history**");
requestDescription.AppendLine("4. De-select the other options");
requestDescription.AppendLine("5. Press request data");
requestDescription.AppendLine("6. Confirm your data request through your email");
requestDescription.AppendLine("7. Wait up to 30 days for Spotify to deliver your files");
response.Embed.AddField($"{DiscordConstants.Spotify} Requesting your data from Spotify",
requestDescription.ToString());

var importDescription = new StringBuilder();

importDescription.AppendLine("1. Download the file Spotify provided");
importDescription.AppendLine(context.SlashCommand
? "2. Use this command and add the `.zip` file as an attachment through the options"
: $"2. Use `/import Spotify` and add the `.zip` file as an attachment through the options");
importDescription.AppendLine("3. Having issues? You can also attach each `.json` file separately");
response.Embed.AddField($"{DiscordConstants.Imports} Importing your data into .fmbot",
importDescription.ToString());

var notesDescription = new StringBuilder();
notesDescription.AppendLine("- We filter out duplicates and skips, so don't worry about submitting the same file twice");
notesDescription.AppendLine("- The importing service is only available with an active supporter subscription");
response.Embed.AddField("📝 Notes", notesDescription.ToString());

var allPlays = await this._playService.GetAllUserPlays(context.ContextUser.UserId, false);
var count = allPlays.Count(w => w.PlaySource == PlaySource.SpotifyImport);
if (count > 0)
{
description.AppendLine("2. Use this command and add the `.zip` file as an attachment through the options");
}
else
{
description.AppendLine(
$"2. Use `/import Spotify` and add the `.zip` file as an attachment through the options");
}

description.AppendLine("3. Having issues? You can also attach each `.json` file separately");

description.AppendLine("### Notes");
description.AppendLine(
"- We filter out duplicates and skips, so don't worry about submitting the same file twice");
description.AppendLine("- You can select what from your import you want to use with `/import manage`");
description.AppendLine("- The importing service is only available with an active supporter subscription");

var importedYears = await this.GetImportedYears(context.ContextUser.UserId, PlaySource.SpotifyImport);
if (importedYears != null)
{
description.AppendLine("### Total imported Spotify plays");
description.AppendLine(importedYears);
response.Embed.AddField($"⚙️ Your imported Spotify plays",
$"You have already imported **{count}** {StringExtensions.GetPlaysString(count)}. To configure how these are used and combined with your Last.fm scrobbles, use the button below.");
}

var footer = new StringBuilder();
Expand All @@ -133,13 +129,16 @@ public async Task<ResponseModel> GetSpotifyImportInstructions(ContextModel conte
footer.AppendLine("Having issues with importing? Please open a help thread on discord.gg/fmbot");

response.Embed.WithFooter(footer.ToString());

response.Embed.WithDescription(description.ToString());

response.Components = new ComponentBuilder()
.WithButton("Spotify privacy page", style: ButtonStyle.Link,
url: "https://www.spotify.com/us/account/privacy/");

if (count > 0)
{
response.Components.WithButton("Manage import settings", InteractionConstants.ImportManage,
style: ButtonStyle.Secondary);
}

return response;
}

Expand All @@ -154,45 +153,49 @@ public async Task<ResponseModel> GetAppleMusicImportInstructions(ContextModel co

response.Embed.WithTitle("Apple Music import instructions");

var description = new StringBuilder();

description.AppendLine("### Requesting your data from Apple");
description.AppendLine("1. Go to your **[Apple privacy settings](https://privacy.apple.com/)**");
description.AppendLine("2. Sign in to your account");
description.AppendLine("3. Click on **Request a copy of your data**");
description.AppendLine("4. Select **Apple Media Services Information**");
description.AppendLine("5. De-select the other options");
description.AppendLine("6. Press **Continue**");
description.AppendLine("7. Press **Complete request**");
description.AppendLine("8. Wait up to 7 days for Apple to deliver your files");

description.AppendLine("### Importing your data into .fmbot");
description.AppendLine("1. Download the file Apple provided");

var requestDescription = new StringBuilder();
requestDescription.AppendLine("1. Go to your **[Apple privacy settings](https://privacy.apple.com/)**");
requestDescription.AppendLine("2. Sign in to your account");
requestDescription.AppendLine("3. Click on **Request a copy of your data**");
requestDescription.AppendLine("4. Select **Apple Media Services Information**");
requestDescription.AppendLine("5. De-select the other options");
requestDescription.AppendLine("6. Press **Continue**");
requestDescription.AppendLine("7. Press **Complete request**");
requestDescription.AppendLine("8. Wait up to 7 days for Apple to deliver your files");
response.Embed.AddField($"{DiscordConstants.AppleMusic} Requesting your data from Apple",
requestDescription.ToString());

var importDescription = new StringBuilder();
importDescription.AppendLine("1. Download the file Apple provided");
if (context.SlashCommand)
{
description.AppendLine("2. Use this command and add the `.zip` file as an attachment through the options");
importDescription.AppendLine("2. Use this command and add the `.zip` file as an attachment through the options");
}
else
{
description.AppendLine(
importDescription.AppendLine(
$"2. Use `/import applemusic` and add the `.zip` file as an attachment through the options");
}

description.AppendLine(
"3. Having issues? You can also attach the `Apple Music Play Activity.csv` file separately");

description.AppendLine("### Notes");
description.AppendLine(
"- Apple provides their history data without artist names. We try to find these as best as possible based on the album and track name.");
description.AppendLine("- You can select what from your import you want to use with `/import manage`");
description.AppendLine("- The importing service is only available with an active supporter subscription");

var importedYears = await this.GetImportedYears(context.ContextUser.UserId, PlaySource.AppleMusicImport);
if (importedYears != null)
importDescription.AppendLine(
"3. Got multiple zip files? You can try them all until one succeeds. Only one of them contains your play history.");
importDescription.AppendLine(
"4. Having issues? You can also attach the `Apple Music Play Activity.csv` file separately");

response.Embed.AddField($"{DiscordConstants.Imports} Importing your data into .fmbot",
importDescription.ToString());

var notes = new StringBuilder();
notes.AppendLine("- Apple provides their history data without artist names. We try to find these as best as possible based on the album and track name.");
notes.AppendLine("- Exceeding Discord file limits? Try on [our server](https://discord.gg/fmbot) in #commands.");
notes.AppendLine("- The importing service is only available with an active supporter subscription");
response.Embed.AddField("📝 Notes", notes.ToString());

var allPlays = await this._playService.GetAllUserPlays(context.ContextUser.UserId, false);
var count = allPlays.Count(w => w.PlaySource == PlaySource.AppleMusicImport);
if (count > 0)
{
description.AppendLine("### Total imported Apple Music plays");
description.AppendLine(importedYears);
response.Embed.AddField($"⚙️ Your imported Apple Music plays",
$"You have already imported **{count}** {StringExtensions.GetPlaysString(count)}. To configure how these are used and combined with your Last.fm scrobbles, use the button below.");
}

var footer = new StringBuilder();
Expand All @@ -206,11 +209,15 @@ public async Task<ResponseModel> GetAppleMusicImportInstructions(ContextModel co

response.Embed.WithFooter(footer.ToString());

response.Embed.WithDescription(description.ToString());

response.Components = new ComponentBuilder()
.WithButton("Apple Data and Privacy", style: ButtonStyle.Link, url: "https://privacy.apple.com/");

if (count > 0)
{
response.Components.WithButton("Manage import settings", InteractionConstants.ImportManage,
style: ButtonStyle.Secondary);
}

return response;
}

Expand Down
5 changes: 3 additions & 2 deletions src/FMBot.Bot/Resources/DiscordConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class DiscordConstants
public static Color InformationColorBlue = new(68, 138, 255);

public static Color SpotifyColorGreen = new(30, 215, 97);

public static Color AppleMusicRed = new(249, 87, 107);

public static readonly IDictionary<IEmote, PaginatorAction> PaginationEmotes = new Dictionary<IEmote, PaginatorAction>
Expand Down Expand Up @@ -48,6 +48,7 @@ public static class DiscordConstants
public const string RateYourMusic = "<:rym:1183851241151930399>";
public const string YouTube = "<:youtube:1230496939355934730>";
public const string AppleMusic = "<:apple_music:1218182727149420544>";

public const string Loading = "<a:loading:821676038102056991>";
public const string Imports = "<:fmbot_importing:1131511469096312914>";
}

0 comments on commit 2b7d61b

Please sign in to comment.