1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +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

@ -463,7 +463,7 @@
<value>You need to specify reminder text!</value>
</data>
<data name="DescriptionReminderCreated" xml:space="preserve">
<value>OK, I'll mention you on {0}</value>
<value>OK, I'll remind you about that</value>
</data>
<data name="InvalidRemindIn" xml:space="preserve">
<value>You need to specify when I should send you the reminder!</value>
@ -603,4 +603,16 @@
<data name="DescriptionActionJumpToMessage" xml:space="preserve">
<value>Jump to message: {0}</value>
</data>
<data name="DescriptionActionJumpToChannel" xml:space="preserve">
<value>Jump to channel: {0}</value>
</data>
<data name="ReminderIndex" xml:space="preserve">
<value>Index: {0}</value>
</data>
<data name="ReminderSentOn" xml:space="preserve">
<value>Reminder will be sent on: {0}</value>
</data>
<data name="ReminderText" xml:space="preserve">
<value>Reminder text: {0}</value>
</data>
</root>

View file

@ -460,7 +460,7 @@
<value>Тебе нужно указать текст напоминания!</value>
</data>
<data name="DescriptionReminderCreated" xml:space="preserve">
<value>Хорошо, я упомяну тебя {0}</value>
<value>Хорошо, я напомню тебе об этом</value>
</data>
<data name="InvalidRemindIn" xml:space="preserve">
<value>Нужно указать время, через которое придёт напоминание!</value>
@ -603,4 +603,16 @@
<data name="DescriptionActionJumpToMessage" xml:space="preserve">
<value>Перейти к сообщению: {0}</value>
</data>
<data name="DescriptionActionJumpToChannel" xml:space="preserve">
<value>Перейти к каналу: {0}</value>
</data>
<data name="ReminderIndex" xml:space="preserve">
<value>Индекс: {0}</value>
</data>
<data name="ReminderSentOn" xml:space="preserve">
<value>Напоминание будет отправлено: {0}</value>
</data>
<data name="ReminderText" xml:space="preserve">
<value>Текст напоминалки: {0}</value>
</data>
</root>

View file

@ -463,7 +463,7 @@
<value>для крафта напоминалки нужен текст</value>
</data>
<data name="DescriptionReminderCreated" xml:space="preserve">
<value>вас понял, упоминание будет {0}</value>
<value>вас понял, я пну тебе об этом</value>
</data>
<data name="InvalidRemindIn" xml:space="preserve">
<value>шизоид у меня на часах такого нету</value>
@ -601,6 +601,18 @@
<value>откатываемся к заводским...</value>
</data>
<data name="DescriptionActionJumpToMessage" xml:space="preserve">
<value>чекнуть: {0}</value>
<value>чекнуть сообщение: {0}</value>
</data>
<data name="DescriptionActionJumpToChannel" xml:space="preserve">
<value>чекнуть канал: {0}</value>
</data>
<data name="ReminderIndex" xml:space="preserve">
<value>индекс: {0}</value>
</data>
<data name="ReminderSentOn" xml:space="preserve">
<value>я пну тебе это: {0}</value>
</data>
<data name="ReminderText" xml:space="preserve">
<value>че там в напоминалке: {0}</value>
</data>
</root>

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)