1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 09:09:00 +03:00

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 // 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(
new Reminder {
RemindAt = reminderOffset,
ReminderText = reminderText, ReminderText = reminderText,
ReminderChannel = cmd.Context.Channel.Id 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

@ -15,4 +15,5 @@ public static class ReplyEmojis {
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:";
} }