reminder: you for real this time

This commit is contained in:
Chris Sexton 2018-10-26 13:38:12 -04:00 committed by Chris Sexton
parent 4644f1893c
commit 4fed267911
2 changed files with 5 additions and 5 deletions

View File

@ -328,14 +328,14 @@ func reminderer(p *ReminderPlugin) {
reminder := p.getNextReminder() reminder := p.getNextReminder()
if reminder != nil && time.Now().UTC().After(reminder.when) { if reminder != nil && time.Now().UTC().After(reminder.when) {
var message string
if reminder.from == reminder.who { if reminder.from == reminder.who {
reminder.from = "you" 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) p.Bot.SendMessage(reminder.channel, message)
if err := p.deleteReminder(reminder.id); err != nil { if err := p.deleteReminder(reminder.id); err != nil {

View File

@ -49,7 +49,7 @@ func TestMeReminder(t *testing.T) {
assert.Len(t, mb.Messages, 2) assert.Len(t, mb.Messages, 2)
assert.True(t, res) assert.True(t, res)
assert.Contains(t, mb.Messages[0], "Okay. I'll remind you.") 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) { func TestReminder(t *testing.T) {