1

I'm writing a telegram bot in golang using github.com/Syfaro/telegram-bot-api. And I need following:

  1. A user sends a command
  2. Bot asks the user a question
  3. The user answers
  4. Then bot does some calculations and sends an answer

I can't find how to send the user an input request. Can anyone, please, help me with it?

updates := bot.ListenForWebhook("/" + bot.Token)

for update := range updates {
        chatID := update.Message.Chat.ID

        if update.Message.IsCommand() {
            msg := tgbotapi.NewMessage(chatID, "")
            switch update.Message.Command() {
            case "command":
                response := tgbotapi.inputRequest(chatId, "Enter some text:")  //pseudocode
                msg.Text = response.Text                                      //
                bot.Send(msg)                                                //
            }
        } else {
            bot.Send(tgbotapi.NewMessage(chatID, "I don't know what to say"))
        }
    }

0 Answers0