WIP reminder list

This commit is contained in:
Hamcha 2018-11-02 15:38:45 +01:00
parent 67926677e5
commit 81db3a6b79
Signed by: hamcha
GPG key ID: A40413D21021EAEE

View file

@ -105,6 +105,23 @@ func remind_message(broker *tg.Broker, update tg.APIMessage) {
whentime := "alle " + timestamp.Format("15:04:05") whentime := "alle " + timestamp.Format("15:04:05")
broker.SendTextMessage(update.Chat, "Ok, vedrò di avvisarti "+whenday+" "+whentime, &update.MessageID) 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 <b>%d</b> reminder in coda per te", len(useritems)), &update.MessageID)
}
} }
func runreminder(id string) { func runreminder(id string) {