diff --git a/locale/Messages.resx b/locale/Messages.resx index cf3de28..82392a8 100644 --- a/locale/Messages.resx +++ b/locale/Messages.resx @@ -591,4 +591,7 @@ Reminder deleted + + You don't have any reminders created! + diff --git a/locale/Messages.ru.resx b/locale/Messages.ru.resx index d4729d1..7b5b3d4 100644 --- a/locale/Messages.ru.resx +++ b/locale/Messages.ru.resx @@ -591,4 +591,7 @@ Напоминание удалено + + У вас нет созданных напоминаний! + diff --git a/locale/Messages.tt-ru.resx b/locale/Messages.tt-ru.resx index ec1c886..bb8c204 100644 --- a/locale/Messages.tt-ru.resx +++ b/locale/Messages.tt-ru.resx @@ -591,4 +591,7 @@ напоминалка уничтожена + + ты еще не крафтил напоминалки + diff --git a/src/Commands/RemindCommandGroup.cs b/src/Commands/RemindCommandGroup.cs index 8e8b820..263d1ba 100644 --- a/src/Commands/RemindCommandGroup.cs +++ b/src/Commands/RemindCommandGroup.cs @@ -61,14 +61,29 @@ public class RemindCommandGroup : CommandGroup return Result.FromError(userResult); } + var currentUserResult = await _userApi.GetCurrentUserAsync(CancellationToken); + if (!currentUserResult.IsDefined(out var currentUser)) + { + return Result.FromError(currentUserResult); + } + var data = await _guildData.GetData(guildId, CancellationToken); Messages.Culture = GuildSettings.Language.Get(data.Settings); - return await ListRemindersAsync(data.GetOrCreateMemberData(userId), user, CancellationToken); + return await ListRemindersAsync(data.GetOrCreateMemberData(userId), user, currentUser, CancellationToken); } - private async Task ListRemindersAsync(MemberData data, IUser user, CancellationToken ct) + private async Task ListRemindersAsync(MemberData data, IUser user, IUser currentUser, CancellationToken ct) { + if (data.Reminders.Count == 0) + { + var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.NoRemindersFound, currentUser) + .WithColour(ColorsList.Red) + .Build(); + + return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct); + } + var builder = new StringBuilder(); for (var i = 0; i < data.Reminders.Count; i++) { diff --git a/src/Messages.Designer.cs b/src/Messages.Designer.cs index b4509e8..0fee435 100644 --- a/src/Messages.Designer.cs +++ b/src/Messages.Designer.cs @@ -995,5 +995,11 @@ namespace Boyfriend { return ResourceManager.GetString("ReminderDeleted", resourceCulture); } } + + internal static string NoRemindersFound { + get { + return ResourceManager.GetString("NoRemindersFound", resourceCulture); + } + } } }