N
N
nblagonravova2019-08-18 23:17:53
Bots
nblagonravova, 2019-08-18 23:17:53

What frameworks are there to write chat bots for vk, telegram and viber at the same time?

I want to write the logic once and use it in three messengers

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Yakushenko, 2019-08-19
@nblagonravova

There are no such.
The basic logic for all APIs is approximately the same, nothing prevents you from creating a command handler class that will receive all your commands and send them to the messengers you need. More or less like this:

>>> class Commands():
...      def print_msg(self, msg):
...          print(msg)
...          print("".join(reversed(msg)))
...
>>> commands = Commands()
>>> commands.print_msg("foo")
foo
oof
>>>

As you can see, I passed a message to method 1, but it was displayed in two different ways.
Although a class is not needed here, it will be more convenient if there are a lot of methods.

D
Denis BotViber, 2020-06-23
@cellmon

DJANGO

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question