S
S
Semyon2020-12-03 12:25:51
linux
Semyon, 2020-12-03 12:25:51

How to set up interaction between telebot and telethon scripts?

There is a bot on telebot and a user account on telethon. You need to take a message from user Y from the bot and forward it on behalf of the user to user X, wait for a response from user X, and then return the response to the bot. The problem lies in the communication between the bot and the user account. in the case of telebot and telethon, there are two scripts with running poolings. There is a possibility of simultaneous access to some buffer file and the need to check it every couple of seconds. I looked at the option with IPC, somehow reluctant to write code that is equivalent in complexity to both bots combined. What are the solutions to this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Amoralny, 2020-12-03
@Hitreno

Well, if I understand correctly, the algorithm can be as follows:
1. The bot receives messages from Y and sends it to the user on telehon (should only accept messages from the bot to telebot)
2. The user sends it to X if only one response is needed - implement a minimal cache, save the recipient id and remove it when you get a response.
3. The received response is sent back to the bot on telebot and forwarded to Y
Kostylno, but, in my opinion, is a simpler method than IPC

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question