@@ -8,14 +8,16 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"valera/commands"
|
||||
"valera/db"
|
||||
)
|
||||
|
||||
const (
|
||||
version = "v0.1.1"
|
||||
version = "v1.0.0"
|
||||
userStateNone = userState("None")
|
||||
userStateGo = userState("Go")
|
||||
userStateGo = userState("Go")
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -89,7 +91,16 @@ func run() {
|
||||
// username := update.Message.From.UserName
|
||||
|
||||
if state == userStateGo {
|
||||
_, _ = bot.Send(tgbot.NewMessage(chatID, text))
|
||||
count, err := strconv.Atoi(text)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
if err := db.AddWorkoutInUser(chatID, db.NewWorkout("Отжимания", count)); err != nil {
|
||||
continue
|
||||
}
|
||||
msg := tgbot.NewMessage(chatID, fmt.Sprintf("Отлично, %s, записал.", text))
|
||||
msg.ReplyMarkup = tgbot.NewHideKeyboard(false)
|
||||
_, _ = bot.Send(msg)
|
||||
state = userStateNone
|
||||
continue
|
||||
}
|
||||
@@ -103,7 +114,7 @@ func run() {
|
||||
case commands.Ping:
|
||||
_, _ = bot.Send(tgbot.NewMessage(chatID, "pong"))
|
||||
case commands.Go:
|
||||
msg := tgbot.NewMessage(chatID, "Давай немного разомнемся, отжимания")
|
||||
msg := tgbot.NewMessage(chatID, "Давай немного разомнемся, отжимания, отпишись сколько раз ты выполнил упражнение")
|
||||
msg.ReplyMarkup = tgbot.NewReplyKeyboard(
|
||||
tgbot.NewKeyboardButtonRow(
|
||||
tgbot.NewKeyboardButton("1"),
|
||||
|
||||
Reference in New Issue
Block a user