mirror of https://github.com/velour/catbase.git
Merge pull request #32 from mccoyst/remind-me
Handle "remind me" I totally read this PR.
This commit is contained in:
commit
10fc4e71f6
|
@ -75,6 +75,10 @@ func reminderer(p *ReminderPlugin) {
|
||||||
|
|
||||||
p.mutex.Unlock()
|
p.mutex.Unlock()
|
||||||
|
|
||||||
|
if reminder.from == reminder.who {
|
||||||
|
reminder.from = "you"
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
p.Bot.SendMessage(reminder.channel, message)
|
p.Bot.SendMessage(reminder.channel, message)
|
||||||
}
|
}
|
||||||
|
@ -90,6 +94,9 @@ func (p *ReminderPlugin) Message(message msg.Message) bool {
|
||||||
if len(parts) >= 5 {
|
if len(parts) >= 5 {
|
||||||
if strings.ToLower(parts[0]) == "remind" {
|
if strings.ToLower(parts[0]) == "remind" {
|
||||||
who := parts[1]
|
who := parts[1]
|
||||||
|
if who == "me" {
|
||||||
|
who = from
|
||||||
|
}
|
||||||
dur, err := time.ParseDuration(parts[3])
|
dur, err := time.ParseDuration(parts[3])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.Bot.SendMessage(channel, "Easy cowboy, not sure I can parse that duration.")
|
p.Bot.SendMessage(channel, "Easy cowboy, not sure I can parse that duration.")
|
||||||
|
|
Loading…
Reference in New Issue