I'm trying to save the user's response to my database. Right now I am able to save the chatId as it comes from the message but I haven't found a way to save the user's response.
` when '/set_price'
question = "Hello #{message.from.first_name}, tell me your price and I will alert you when the Gas price is at or below your target price."
@replyMessage = bot.api.send_message(chat_id: message.chat.id, text: question, )['result']
@userResponse = bot.api.copy_message(chat_id: message.chat.id, from_chat_id: message.chat.id, message_id:
@replyMessage["message_id"] )
get all chats saved in db
chats = Telebot.all
chats.each {
|chat| if message.chat.id === chat.chatId
@price = @userResponse
i = chat
i.update_attribute(:price, @price)
i.save
I'm trying to save the user's response to my database. Right now I am able to save the chatId as it comes from the message but I haven't found a way to save the user's response.
` when '/set_price'
get all chats saved in db
end }
end`
Any help will be greatly appreciated.