mirror of https://github.com/velour/catbase.git
reminder: you for real this time
This commit is contained in:
parent
4644f1893c
commit
4fed267911
|
@ -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 {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue