From 81db3a6b7949d3b2318f15899f01be3ff9d27a04 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Fri, 2 Nov 2018 15:38:45 +0100 Subject: [PATCH] WIP reminder list --- mods/remind.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mods/remind.go b/mods/remind.go index 456e19f..f2c687e 100644 --- a/mods/remind.go +++ b/mods/remind.go @@ -105,6 +105,23 @@ func remind_message(broker *tg.Broker, update tg.APIMessage) { whentime := "alle " + timestamp.Format("15:04:05") broker.SendTextMessage(update.Chat, "Ok, vedrĂ² di avvisarti "+whenday+" "+whentime, &update.MessageID) } + + if isCommand(update, "reminders") { + // Should only work in private chats + if update.Chat.Type != tg.ChatTypePrivate { + broker.SendTextMessage(update.Chat, "Per favore chiedimi in privato dei reminder", &update.MessageID) + return + } + + useritems := []Reminder{} + for _, reminder := range reminders { + if reminder.TargetID == update.User.UserID { + useritems = append(useritems, reminder) + } + } + + broker.SendTextMessage(update.Chat, fmt.Sprintf("Ci sono %d reminder in coda per te", len(useritems)), &update.MessageID) + } } func runreminder(id string) {