@@ -27,14 +27,14 @@ func NewEatBotState(bot *tgbot.BotAPI, dataBase *db.DB) states.BotState {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *eatBotState) Do(text string, chatInfo *db.ChatInfo, username string) error {
|
||||
func (s *eatBotState) Do(text string, chatInfo *db.ChatInfo) error {
|
||||
if chatInfo.Status == string(db.UserStateEat) {
|
||||
count, err := calcCalories(text)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return nil
|
||||
}
|
||||
if err := s.dataBase.AddCalories(chatInfo.ChatID, db.NewCalories(count, username)); err != nil {
|
||||
if err := s.dataBase.AddCalories(chatInfo.ChatID, db.NewCalories(count, chatInfo.Username)); err != nil {
|
||||
log.Println(err)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user