From 4fed267911df062f274d1dadb3d7079fddd9252f Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Fri, 26 Oct 2018 13:38:12 -0400 Subject: [PATCH] reminder: you for real this time --- plugins/reminder/reminder.go | 8 ++++---- plugins/reminder/reminder_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/reminder/reminder.go b/plugins/reminder/reminder.go index 98b6bf2..e4a83d0 100644 --- a/plugins/reminder/reminder.go +++ b/plugins/reminder/reminder.go @@ -328,14 +328,14 @@ func reminderer(p *ReminderPlugin) { reminder := p.getNextReminder() if reminder != nil && time.Now().UTC().After(reminder.when) { + var message string if reminder.from == reminder.who { reminder.from = "you" + message = fmt.Sprintf("Hey %s, you wanted to be reminded: %s", reminder.who, reminder.what) + } else { + message = fmt.Sprintf("Hey %s, %s wanted you to be reminded: %s", reminder.who, reminder.from, reminder.what) } - message := fmt.Sprintf("Hey %s, %s wanted you to be reminded: %s", reminder.who, reminder.from, reminder.what) - if reminder.who == reminder.from { - message = fmt.Sprintf("Hey %s, %s wanted to be reminded: %s", reminder.who, reminder.from, reminder.what) - } p.Bot.SendMessage(reminder.channel, message) if err := p.deleteReminder(reminder.id); err != nil { diff --git a/plugins/reminder/reminder_test.go b/plugins/reminder/reminder_test.go index cd76931..dc9f38b 100644 --- a/plugins/reminder/reminder_test.go +++ b/plugins/reminder/reminder_test.go @@ -49,7 +49,7 @@ func TestMeReminder(t *testing.T) { assert.Len(t, mb.Messages, 2) assert.True(t, res) assert.Contains(t, mb.Messages[0], "Okay. I'll remind you.") - assert.Contains(t, mb.Messages[1], "Hey tester, you wanted you to be reminded: don't fail this test") + assert.Contains(t, mb.Messages[1], "Hey tester, you wanted to be reminded: don't fail this test") } func TestReminder(t *testing.T) {