using NetCord; using NetCord.Services; using NetCord.Services.ApplicationCommands; using StreakBot.Services; namespace StreakBot.Commands; public class CheckStreakCommand : ApplicationCommandModule { private readonly StreakService _streakService; public CheckStreakCommand(StreakService streakService) { _streakService = streakService; } [SlashCommand("streak", "Check your daily streak with another user")] public async Task CheckStreak() { if (Context.Interaction.GuildId is not null) { return "This command can only be used in a dm!"; } var initiatorId = Context.User.Id; var streaks = await _streakService.CheckStreaksAsync(initiatorId); if (!streaks.Any()) { return "You have no streaks."; } var output = "You have the following streaks:"; foreach (var streak in streaks) { var targetId = streak.User1Id == initiatorId ? streak.User2Id : streak.User1Id; output += $"\n\nYour streak with <@{targetId}> started on {streak.CreatedDate:MMM-dd-yyyy}, and your current streak pet is {streak.StreakNumber} days old!"; } return output; } }