A
A
Artur01112022-02-22 18:50:29
Database
Artur0111, 2022-02-22 18:50:29

How to split words in telebot message?

I have a code:

firstName='Ivan'
lastName='Petrov'
middleName='Ivanovich'
privatePersonbirthday='01/01/2000'

How can I make a person write all the data in these lines with one message?
If what is this tg bot

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Denis Zagaevsky, 2016-03-25
@zagayevskiy

Your case is similar to MVP, without a more detailed description it's hard to judge.
There are also MPC, MVVM, for example. I'm sure they will add me.

S
Stanislav Makarov, 2016-03-26
@Nipheris

On what basis do you want to classify? I can call such an architecture client-server, and also multi-layered.
What are the alternatives? Well, firstly, WCF itself can be very different, both SOAP and REST. Secondly, some clients (for example, of an administrative nature) can cling directly to the database (for example, they have access to the server via VPN), and then there is no web service between the database and the client.
Also, the application may not work immediately with the web service / database, but for example, store data in a local database (some SQLite), and then synchronize it with the main database - also through the service or directly (depending on the trust in the client application) - this is more difficult in terms of setting up the whole process, but sometimes it is simply necessary if communication with the central database server is not guaranteed (sometimes applications on mobile devices must work outside a big city and a thick 4G channel).
The WCF service can use an ORM, or the programmer can write all the SQL queries in advance.
A WCF service can also be hosted on IIS, if that's convenient. Although, if it performs background operations in the database, then it is quite correct and logical to host it in the Windows service.
Each of the layers you listed can be changed / removed / simplified / complicated. And also, for example, you can remember about multi-user work and possible problems when different people work with the same data, which will also affect almost all layers in your scheme.
What are you specifically interested in? You need to at least talk about the client or service separately, because. these are in themselves large components with their own architecture.

V
Vindicar, 2022-02-22
@Vindicar

In theory, you can require to enter a string in the form "Petrov Ivan Ivanovich 01/01/2000", and then cut by spaces.
But this will provoke user errors - once, and it will stumble on some names (even Abdurakhman ibn Hottab) - two.
I would advise not to break the name into pieces unnecessarily.

A
Alexander Nesterov, 2022-02-22
@AlexNest

If you write on telebot / pyTelegramBotAPI (seemingly) - use register_next_step_handler
If aiogram is a state machine and take part of the full name at a time.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question