remind: Allow text-less reminders (only with forwarded messages)

This commit is contained in:
Hamcha 2017-05-04 17:15:04 +02:00
parent e11aff1c8e
commit a9acbe719e
1 changed files with 6 additions and 0 deletions

View File

@ -60,6 +60,12 @@ func remind(broker *tg.Broker, update tg.APIMessage) {
// dd/mm/yyyy-HH:MM:SS => specific hour, specific date
parts := strings.SplitN(*(update.Text), " ", 3)
// Little hack to allow text-less reminders with replies
if len(parts) == 2 && update.ReplyTo != nil {
parts = append(parts, "")
}
if len(parts) < 3 {
broker.SendTextMessage(update.Chat, "<b>Sintassi</b>\n/ricordami <i>[quando]</i> Messaggio\n\n<b>Formati supportati per [quando]</b>:\n 10s 10m 10h 10d (secondi/minuti/ore/giorni)\n 13:20 15:55:01 (ora dello stesso giorno, formato 24h)\n 11/02/2099 11/02/2099-11:20:01 (giorno diverso, stessa ora [1] o specifica [2])", &update.MessageID)
return