1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-10 16:03:15 +03:00

Redesign /remind, /listremind, MessagesDeletedResponder

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
This commit is contained in:
Macintxsh 2023-09-28 17:41:45 +03:00
parent dac158e1e9
commit a4aebd49ef
Signed by: mctaylors
GPG key ID: 361D326747B61E65
6 changed files with 83 additions and 11 deletions

View file

@ -19,7 +19,7 @@ using Remora.Results;
namespace Boyfriend.Commands;
/// <summary>
/// Handles the command to manage reminders: /remind
/// Handles commands to manage reminders: /remind, /listremind, /delremind
/// </summary>
[UsedImplicitly]
public class RemindCommandGroup : CommandGroup
@ -88,8 +88,9 @@ public class RemindCommandGroup : CommandGroup
for (var i = data.Reminders.Count - 1; i >= 0; i--)
{
var reminder = data.Reminders[i];
builder.AppendLine(
$"- {Markdown.InlineCode(i.ToString())} - {Markdown.InlineCode(reminder.Text)} - {Markdown.Timestamp(reminder.At)}");
builder.Append("- ").AppendLine(string.Format(Messages.ReminderIndex, Markdown.InlineCode(i.ToString())))
.Append(" - ").AppendLine(string.Format(Messages.ReminderText, Markdown.InlineCode(reminder.Text)))
.Append(" - ").AppendLine(string.Format(Messages.ReminderSentOn, Markdown.Timestamp(reminder.At)));
}
var embed = new EmbedBuilder().WithSmallTitle(
@ -149,8 +150,14 @@ public class RemindCommandGroup : CommandGroup
Text = message
});
var embed = new EmbedBuilder().WithSmallTitle(string.Format(Messages.ReminderCreated, user.GetTag()), user)
.WithDescription(string.Format(Messages.DescriptionReminderCreated, Markdown.Timestamp(remindAt)))
var builder = new StringBuilder().Append("- ").AppendLine(string.Format(
Messages.ReminderText, Markdown.InlineCode(message)))
.Append("- ").Append(string.Format(Messages.ReminderSentOn, Markdown.Timestamp(remindAt)));
var embed = new EmbedBuilder().WithSmallTitle(
string.Format(Messages.ReminderCreated, user.GetTag()), user)
.WithTitle(Messages.DescriptionReminderCreated)
.WithDescription(builder.ToString())
.WithColour(ColorsList.Green)
.Build();

View file

@ -1019,5 +1019,29 @@ namespace Boyfriend {
return ResourceManager.GetString("DescriptionActionJumpToMessage", resourceCulture);
}
}
internal static string DescriptionActionJumpToChannel {
get {
return ResourceManager.GetString("DescriptionActionJumpToChannel", resourceCulture);
}
}
internal static string ReminderIndex {
get {
return ResourceManager.GetString("ReminderIndex", resourceCulture);
}
}
internal static string ReminderSentOn {
get {
return ResourceManager.GetString("ReminderSentOn", resourceCulture);
}
}
internal static string ReminderText {
get {
return ResourceManager.GetString("ReminderText", resourceCulture);
}
}
}
}

View file

@ -1,3 +1,4 @@
using System.Text;
using Boyfriend.Data;
using Boyfriend.Services;
using JetBrains.Annotations;
@ -81,13 +82,17 @@ public class MessageDeletedResponder : IResponder<IMessageDelete>
Messages.Culture = GuildSettings.Language.Get(cfg);
var builder = new StringBuilder().AppendLine(
string.Format(Messages.DescriptionActionJumpToChannel,
Mention.Channel(gatewayEvent.ChannelID)))
.AppendLine(message.Content.InBlockCode());
var embed = new EmbedBuilder()
.WithSmallTitle(
string.Format(
Messages.CachedMessageDeleted,
message.Author.GetTag()), message.Author)
.WithDescription(
$"{Mention.Channel(gatewayEvent.ChannelID)}\n{message.Content.InBlockCode()}")
.WithDescription(builder.ToString())
.WithActionFooter(user)
.WithTimestamp(message.Timestamp)
.WithColour(ColorsList.Red)