From 2a0030869532732cccd7eeb186a4b9887870a35a Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sat, 9 Mar 2019 21:55:01 -0500 Subject: [PATCH] reminder: fix bad subtraction --- plugins/reminder/reminder.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/reminder/reminder.go b/plugins/reminder/reminder.go index 3704d36..bdc4568 100644 --- a/plugins/reminder/reminder.go +++ b/plugins/reminder/reminder.go @@ -91,8 +91,12 @@ func (p *ReminderPlugin) message(kind bot.Kind, message msg.Message, args ...int t, err := p.when.Parse(message.Body, time.Now()) // Allowing err to fallthrough for other parsing if t != nil && err == nil { - t2 := time.Now().Sub(t.Time).String() + t2 := t.Time.Sub(time.Now()).String() message.Body = string(message.Body[0:t.Index]) + t2 + string(message.Body[t.Index+len(t.Text):]) + log.Debug(). + Str("body", message.Body). + Str("text", t.Text). + Msg("Got time request") } parts := strings.Fields(message.Body)