···11+using NetCord;
22+using NetCord.Services.ApplicationCommands;
33+using StreakBot.Services;
44+55+namespace StreakBot.Commands;
66+77+public class RestoreCommand : ApplicationCommandModule<ApplicationCommandContext>
88+{
99+ private readonly StreakService _streakService;
1010+1111+ public RestoreCommand(StreakService streakService)
1212+ {
1313+ _streakService = streakService;
1414+ }
1515+1616+ [SlashCommand("restore", "Restores your streak with another user after it has been reset. Limited to 5 restores per month.")]
1717+ public async Task<string> Restore(
1818+ [SlashCommandParameter(Name = "user", Description = "The user to restore your streak with")]
1919+ User user)
2020+ {
2121+ var initiatorId = Context.User.Id;
2222+ var targetId = user.Id;
2323+2424+ if (initiatorId == targetId)
2525+ {
2626+ return "You can't restore a streak with yourself!";
2727+ }
2828+2929+ if (user.IsBot)
3030+ {
3131+ return "You can't restore a streak with a bot!";
3232+ }
3333+3434+ return await _streakService.RestoreStreakAsync(initiatorId, targetId);
3535+ }
3636+}
+2
Data/Entities/Streak.cs
···1313 public int StreakNumber { get; set; }
1414 public DateTime LastResetCheck { get; set; }
1515 public bool ReminderSent { get; set; }
1616+ public int? StreakNumberToRestore { get; set; }
1717+ public int MonthlyRestores { get; set; } = 5;
1618}