view bot/bot.go @ 10:5c124578fed2

fix timer bug
author Dennis C. M. <dennis@denniscm.com>
date Sat, 15 Mar 2025 17:03:53 +0000
parents e9df3bb010f4
children
line wrap: on
line source

package bot

import (
	"log"
	"strconv"
)

func HandleCmd(cmd []string) {
	cmdReceived := cmd[0]
	log.Printf("bot: %s command received", cmdReceived)

	switch cmdReceived {
	case "timer":
		seconds, err := strconv.Atoi(cmd[1])

		if err != nil {
			log.Fatal("bot: invalid command arguments")
		}

		startTimer(seconds)
	}
}