From e47a9ca99cca3c2225496a120a61bc9459135d3a Mon Sep 17 00:00:00 2001 From: Kwoth Date: Fri, 26 Aug 2016 03:35:10 +0200 Subject: [PATCH] Reminder fixed --- src/NadekoBot/Modules/Utility/Commands/Remind.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NadekoBot/Modules/Utility/Commands/Remind.cs b/src/NadekoBot/Modules/Utility/Commands/Remind.cs index be2bad6e..4036d8c0 100644 --- a/src/NadekoBot/Modules/Utility/Commands/Remind.cs +++ b/src/NadekoBot/Modules/Utility/Commands/Remind.cs @@ -48,10 +48,8 @@ namespace NadekoBot.Modules.Utility { var now = DateTime.Now; var twoMins = new TimeSpan(0, 2, 0); - TimeSpan time = (r.When - now) < twoMins - ? twoMins //if the time is less than 2 minutes, - : r.When - now; //it will send the message 2 minutes after start - //To account for high bot startup times + TimeSpan time = r.When - now; + if (time.TotalMilliseconds > int.MaxValue) return; @@ -180,9 +178,11 @@ namespace NadekoBot.Modules.Utility using (var uow = DbHandler.UnitOfWork()) { uow.Reminders.Add(rem); + await uow.CompleteAsync(); } await channel.SendMessageAsync($"⏰ I will remind \"{(ch is ITextChannel ? ((ITextChannel)ch).Name : imsg.Author.Username)}\" to \"{message.ToString()}\" in {output}. ({time:d.M.yyyy.} at {time:HH:mm})").ConfigureAwait(false); + await StartReminder(rem); } ////todo owner only