1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-14 01:36:08 +03:00

Add more info output to /delremind

Signed-off-by: mctaylors <mctaylxrs@outlook.com>
This commit is contained in:
Macintxsh 2023-10-26 16:38:30 +03:00
parent 02707312f5
commit c90b744fec
Signed by: mctaylors
GPG key ID: 194ED59274F61F79
5 changed files with 26 additions and 2 deletions

View file

@ -195,12 +195,14 @@ public class RemindCommandGroup : CommandGroup
var data = await _guildData.GetData(guildId, CancellationToken);
Messages.Culture = GuildSettings.Language.Get(data.Settings);
return await DeleteReminderAsync(data.GetOrCreateMemberData(executorId), position - 1, bot, CancellationToken);
return await DeleteReminderAsync(data.GetOrCreateMemberData(executorId), position, bot, CancellationToken);
}
private async Task<Result> DeleteReminderAsync(MemberData data, int index, IUser bot,
private async Task<Result> DeleteReminderAsync(MemberData data, int position, IUser bot,
CancellationToken ct)
{
var index = position - 1;
if (index >= data.Reminders.Count)
{
var failedEmbed = new EmbedBuilder().WithSmallTitle(Messages.InvalidReminderPosition, bot)
@ -210,9 +212,14 @@ public class RemindCommandGroup : CommandGroup
return await _feedback.SendContextualEmbedResultAsync(failedEmbed, ct);
}
var description = new StringBuilder()
.Append("- ").AppendLine(string.Format(Messages.ReminderSelectedPosition, Markdown.InlineCode(position.ToString())))
.Append("- ").AppendLine(string.Format(Messages.ReminderText, Markdown.InlineCode(data.Reminders[index].Text)));
data.Reminders.RemoveAt(index);
var embed = new EmbedBuilder().WithSmallTitle(Messages.ReminderDeleted, bot)
.WithDescription(description.ToString())
.WithColour(ColorsList.Green)
.Build();