Compare commits

...

2 Commits

Author SHA1 Message Date
Hamcha 3f1f822b8c
Add mixed durations in reminder
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is failing Details
2022-03-27 23:17:28 +02:00
Hamcha 0279e6bd35
Command parsing fixes
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-03-27 22:53:50 +02:00
3 changed files with 5 additions and 8 deletions

View File

@ -51,7 +51,7 @@ func (m *Module) OnUpdate(update tg.APIUpdate) {
return
}
if utils.IsCommand(*update.Message, m.name, "metafora") {
if utils.IsCommand(*update.Message, m.name, "proverbio") {
start := rand.Intn(len(proverbipairs.start))
end := rand.Intn(len(proverbipairs.end))
m.client.SendTextMessage(tg.ClientTextMessageData{

View File

@ -254,15 +254,12 @@ func scanMixedDelay(str string) (bool, time.Time, error) {
default:
return true, now, fmt.Errorf("La durata ha una unità che non conosco, usa una di queste: s (secondi) m (minuti) h (ore) d (giorni)")
}
return true, now.Add(dur), nil
}
/* TO FIX
now = now.Add(dur)
remaining = remaining[scanned:]
nextIndex := strings.IndexRune(remaining, sep)
remaining = remaining[nextIndex+1:]
}
fmt.Printf("tot: %s", now.Sub(time.Now()))
return true, now, nil
*/
return false, now, nil
}
func parseDuration(date string, loc *time.Location) (time.Time, error) {

View File

@ -22,7 +22,7 @@ func IsCommand(update tg.APIMessage, botname string, cmdname string) bool {
}
// Check long form
if text == shortcmd || strings.HasPrefix(text, fullcmd+" ") {
if text == fullcmd || strings.HasPrefix(text, fullcmd+" ") {
return true
}