A
A
anijack2021-11-20 10:54:21
Python
anijack, 2021-11-20 10:54:21

How to properly design a chat bot architecture?

There is a task to write a relatively complex chat bot with great functionality for Telegram.
I'm using pyTelegramBotAPI , where constructions like this are used to handle events:

@bot.message_handler(commands=['start'])
def start(message):
    bot.send_message(message.from_user.id, "Привет")


Most of the tutorials and documentation use simple examples, where such handlers just go one after another in one file.
But the bot will not process a couple of commands, issuing pre-prepared answers, so if everything is done as described above, a million instructions will come out in a row in one file, which, in my opinion, is not good.

Perhaps there are some options to organize this business more beautifully and competently?

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ross Alex, 2021-11-20
@Wacdis

MVC will be fine!

V
Vindicar, 2021-11-20
@Vindicar

Look towards Cogs in discord.py . As the name suggests, either for discord and not for the cart, but can you make an analog? For me, they are quite comfortable.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question