Add reminder creation feedback (#24)

This commit is contained in:
Macintxsh 2023-02-02 07:48:18 +03:00 committed by GitHub
parent eaeacc1206
commit 233d471600
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 167 additions and 142 deletions

View file

@ -9,15 +9,21 @@ public sealed class RemindCommand : ICommand {
// TODO: actually make this good
var remindIn = CommandProcessor.GetTimeSpan(args, 0);
var reminderText = cmd.GetRemaining(cleanArgs, 1, "ReminderText");
if (reminderText is not null)
GuildData.Get(cmd.Context.Guild).MemberData[cmd.Context.User.Id].Reminders.Add(new Reminder {
RemindAt = DateTimeOffset.Now.Add(remindIn),
var reminderOffset = DateTimeOffset.Now.Add(remindIn);
if (reminderText is not null) {
GuildData.Get(cmd.Context.Guild).MemberData[cmd.Context.User.Id].Reminders.Add(
new Reminder {
RemindAt = reminderOffset,
ReminderText = reminderText,
ReminderChannel = cmd.Context.Channel.Id
});
cmd.ConfigWriteScheduled = true;
var feedback = string.Format(Messages.FeedbackReminderAdded, reminderOffset.ToUnixTimeSeconds().ToString());
cmd.Reply(feedback, ReplyEmojis.Reminder);
}
return Task.CompletedTask;
}
}

9
Messages.Designer.cs generated
View file

@ -1102,5 +1102,14 @@ namespace Boyfriend {
return ResourceManager.GetString("YouWereKicked", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to OK, I'll mention you on &lt;t:{0}:f&gt;.
/// </summary>
internal static string FeedbackReminderAdded {
get {
return ResourceManager.GetString("FeedbackReminderAdded", resourceCulture);
}
}
}
}

View file

@ -465,4 +465,7 @@
<data name="MissingReminderText" xml:space="preserve">
<value>You need to specify reminder text!</value>
</data>
<data name="FeedbackReminderAdded" xml:space="preserve">
<value>OK, I'll mention you on &lt;t:{0}:f&gt;</value>
</data>
</root>

View file

@ -465,4 +465,7 @@
<data name="MissingReminderText" xml:space="preserve">
<value>Тебе нужно указать текст напоминания!</value>
</data>
<data name="FeedbackReminderAdded" xml:space="preserve">
<value>Хорошо, я упомяну тебя &lt;t:{0}:f&gt;</value>
</data>
</root>

View file

@ -465,4 +465,7 @@
<data name="MissingReminderText" xml:space="preserve">
<value>для крафта напоминалки нужен текст</value>
</data>
<data name="FeedbackReminderAdded" xml:space="preserve">
<value>вас понял, упоминание будет &lt;t:{0}:f&gt;</value>
</data>
</root>

View file

@ -15,4 +15,5 @@ public static class ReplyEmojis {
public const string Kicked = ":police_car:";
public const string Muted = ":mute:";
public const string Unmuted = ":loud_sound:";
public const string Reminder = ":alarm_clock:";
}