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

9
Messages.Designer.cs generated
View file

@ -1102,5 +1102,14 @@ namespace Boyfriend {
return ResourceManager.GetString("YouWereKicked", resourceCulture); 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"> <data name="MissingReminderText" xml:space="preserve">
<value>You need to specify reminder text!</value> <value>You need to specify reminder text!</value>
</data> </data>
<data name="FeedbackReminderAdded" xml:space="preserve">
<value>OK, I'll mention you on &lt;t:{0}:f&gt;</value>
</data>
</root> </root>

View file

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

View file

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

View file

@ -1,18 +1,19 @@
namespace Boyfriend; namespace Boyfriend;
public static class ReplyEmojis { public static class ReplyEmojis {
public const string Success = ":white_check_mark:"; public const string Success = ":white_check_mark:";
public const string Error = ":x:"; public const string Error = ":x:";
public const string MissingArgument = ":keyboard:"; public const string MissingArgument = ":keyboard:";
public const string InvalidArgument = ":construction:"; public const string InvalidArgument = ":construction:";
public const string NoPermission = ":no_entry_sign:"; public const string NoPermission = ":no_entry_sign:";
public const string CantInteract = ":vertical_traffic_light:"; public const string CantInteract = ":vertical_traffic_light:";
public const string Help = ":page_facing_up:"; public const string Help = ":page_facing_up:";
public const string SettingsList = ":gear:"; public const string SettingsList = ":gear:";
public const string SettingsSet = ":control_knobs:"; public const string SettingsSet = ":control_knobs:";
public const string Ping = ":signal_strength:"; public const string Ping = ":signal_strength:";
public const string Banned = ":hammer:"; public const string Banned = ":hammer:";
public const string Kicked = ":police_car:"; public const string Kicked = ":police_car:";
public const string Muted = ":mute:"; public const string Muted = ":mute:";
public const string Unmuted = ":loud_sound:"; public const string Unmuted = ":loud_sound:";
public const string Reminder = ":alarm_clock:";
} }