mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-30 02:59:54 +03:00
Do not allow setting reminders without specifying a valid TimeSpan
Fixes #19 Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
8f9c71edf1
commit
a97341f9a9
7 changed files with 39 additions and 15 deletions
|
@ -8,9 +8,14 @@ public sealed class RemindCommand : ICommand {
|
|||
public Task RunAsync(CommandProcessor cmd, string[] args, string[] cleanArgs) {
|
||||
// TODO: actually make this good
|
||||
var remindIn = CommandProcessor.GetTimeSpan(args, 0);
|
||||
if (remindIn.TotalSeconds < 1) {
|
||||
cmd.Reply(Messages.InvalidRemindIn, ReplyEmojis.InvalidArgument);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
var reminderText = cmd.GetRemaining(cleanArgs, 1, "ReminderText");
|
||||
var reminderOffset = DateTimeOffset.Now.Add(remindIn);
|
||||
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 {
|
||||
RemindAt = reminderOffset,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue