Search code examples
pythonvariablesbotspy-telegram-bot-api

how to enter the user's reply message on the bot and put it in a variable


so the problem here is I want to enter data into the database via a bot, and I'm trying to retrieve word for word with arrays or indexing, but what if the user wants to enter data into the name column and has a varied name which can consist of 4-3 sentences, so do you guys have a solution My Code

I'm confused, I hope someone can help me


Solution

  • You can assume that class and status are always a single word so take texts[-1] as status, texts[-2] as class and texts[:-2] as the name. This way if it is a name with 3-4 words then all of it will be accounted for.