Skip to content

Commit

Permalink
work on import modify
Browse files Browse the repository at this point in the history
  • Loading branch information
th0mk committed Jan 10, 2025
1 parent 0dc392f commit 42bcba1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 30 deletions.
44 changes: 21 additions & 23 deletions src/FMBot.Bot/Builders/ImportBuilders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,50 +290,48 @@ public async Task<ResponseModel> ImportModify(ContextModel context, int userId)
embedDescription.AppendLine("Modify your imported .fmbot data with the options below.");
embedDescription.AppendLine();
embedDescription.AppendLine(
"Please keep in mind that this only modifies imports that are stored in .fmbot. Importing in .fmbot works by combining imported plays together with Last.fm scrobbles.");
"Please keep in mind that this only modifies imports that are stored in .fmbot. It doesn't modify any of your Last.fm scrobbles or data.");
embedDescription.AppendLine();
embedDescription.AppendLine("No Last.fm data can be changed or removed with this command.");
embedDescription.AppendLine();

embedDescription.AppendLine($"**Full Imports, then Last.fm**");
embedDescription.AppendLine($"- Uses your full {importSource} history and adds Last.fm afterwards");
embedDescription.AppendLine("- Plays from other music apps you scrobbled to Last.fm will not be included");

if (!hasImported)
{
embedDescription.AppendLine();
embedDescription.AppendLine(
"Run the `/import spotify` command to see how to request your data and to get started with imports. " +
"Run the `.import` command to see how to request your data and to get started with imports. " +
"After importing you'll be able to change these settings.");
}
else
{
embedDescription.AppendLine();
embedDescription.AppendLine($"**Total counts**");
var storedDescription = new StringBuilder();
if (allPlays.Any(a => a.PlaySource == PlaySource.AppleMusicImport))
{
embedDescription.AppendLine(
storedDescription.AppendLine(
$"- {allPlays.Count(c => c.PlaySource == PlaySource.AppleMusicImport)} imported Apple Music plays");
}

if (allPlays.Any(a => a.PlaySource == PlaySource.SpotifyImport))
{
embedDescription.AppendLine(
storedDescription.AppendLine(
$"- {allPlays.Count(c => c.PlaySource == PlaySource.SpotifyImport)} imported Spotify plays");
}

embedDescription.AppendLine(
$"- {allPlays.Count(c => c.PlaySource == PlaySource.LastFm)} Last.fm scrobbles");
response.Embed.AddField($"{DiscordConstants.Imports} Your stored imports", storedDescription.ToString());

var playResult =
await this._playService.GetPlaysWithDataSource(userId, context.ContextUser.DataSource);
embedDescription.AppendLine();
embedDescription.AppendLine($"**Data in use with your selected mode**");
embedDescription.Append(
$"- {playResult.Count(c => c.PlaySource == PlaySource.SpotifyImport || c.PlaySource == PlaySource.AppleMusicImport)} imports + ");
embedDescription.Append(
$"{playResult.Count(c => c.PlaySource == PlaySource.LastFm)} scrobbles = ");
embedDescription.Append($"{playResult.Count} plays");
var noteDescription = new StringBuilder();
if (context.ContextUser.DataSource == DataSource.ImportThenFullLastFm)
{
noteDescription.AppendLine(
"Because you have selected the mode **Imports, then full Last.fm** not all imports might be used. This mode only uses your imports up until you started scrobbling on Last.fm.");
}
else
{

}

if (noteDescription.Length > 0)
{
response.Embed.AddField($"📝 How your imports are used", noteDescription.ToString());
}
}

response.Embed.WithDescription(embedDescription.ToString());
Expand Down
2 changes: 1 addition & 1 deletion src/FMBot.Bot/Services/TimerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void QueueMasterJobs()
RecurringJob.AddOrUpdate(nameof(AddLatestDiscordSupporters), () => AddLatestDiscordSupporters(), "*/4 * * * *");

Log.Information($"RecurringJob: Adding {nameof(CheckExpiredDiscordSupporters)}");
RecurringJob.AddOrUpdate(nameof(CheckExpiredDiscordSupporters), () => CheckExpiredDiscordSupporters(), "0 8,18 * * *");
RecurringJob.AddOrUpdate(nameof(CheckExpiredDiscordSupporters), () => CheckExpiredDiscordSupporters(), "0 */3 * * *");

Log.Information($"RecurringJob: Adding {nameof(PickNewFeatureds)}");
RecurringJob.AddOrUpdate(nameof(PickNewFeatureds), () => PickNewFeatureds(), "0 12 * * *");
Expand Down
2 changes: 1 addition & 1 deletion src/FMBot.Bot/SlashCommands/StaticSlashCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public async Task GetManageOverview()
else
{
manageDescription.AppendLine(
"You have lifetime supporter, so there is nothing to manage. Enjoy your supporter!");
"You have lifetime supporter, so there is nothing to manage. Enjoy your supporter! <a:msn_dancing_banana:887595947025133569>");
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/FMBot.Bot/TextCommands/ImportCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public async Task ImportSpotifyAsync([Remainder] string _ = null)
this.Context.LogCommandUsed(response.CommandResponse);
}

// [Command("importmodify", RunMode = RunMode.Async)]
// [Summary("Deletes your .fmbot account")]
// [Alias("modifyimport", "importsmodify", "modifyimports", "import modify")]
// [CommandCategories(CommandCategory.UserSettings)]
// [UsernameSetRequired]
[Command("importmodify", RunMode = RunMode.Async)]
[Summary("Allows you to modify your .fmbot imports")]
[Alias("modifyimport", "importsmodify", "modifyimports", "import modify")]
[CommandCategories(CommandCategory.UserSettings)]
[UsernameSetRequired]
public async Task ModifyImportAsync([Remainder] string confirmation = null)
{
var contextUser = await this._userService.GetFullUserAsync(this.Context.User.Id);
Expand Down

0 comments on commit 42bcba1

Please sign in to comment.