-2

So, I'm trying to make a bot in Telegram (training for future assignments). I'm using pyTelegramBotAPI and sqlite3, and I've got a question in process. I have created a database (example.db) and an inline button, and now I need to connect this database to a bot, and make it read db's contents (table with a list in it), and print them in message as an answer to a pressed button. F.E.: Message would be like this: "You have a list of things here: 1) Num.1 2) Num.2 .." And a whole list like that.

I'd be glad to hear any advices and code examples, thank you very much.

1 Answers1

0

Try to use an iterative approach:

  1. Try go get data from database in format you wish, try to print this to terminal. when this works go to step 2.

  2. Try to send a test message to your telegram bot. when you've got this working go to step 3.

  3. Now combine step 1 and step 2, so get data from database and send it to bot.

  4. Last step is to add button click to above functions you created.

NemoMeMeliorEst
  • 513
  • 4
  • 10