R
R
Roman2020-10-12 22:55:37
Python
Roman, 2020-10-12 22:55:37

How to use this function from the telebot module to apply it in the source code?

Good day to all, I'm new to programming, I don't really understand how to work with Python libraries (I re-read a lot of material and I just don't understand, a message with ridicule and instructions like go teach, please don't write, thanks), this method how can I implement it, I it is necessary to implement so that the user presses the inline keyboard and after that technical support unsubscribes directly to the bot to the client. If I made a mistake in choosing a method, then tell me which one to choose and how to implement it? Thank you all in advance) if anything, then I used the 'telebot' library

def register_next_step_handler(self, message, callback, *args, **kwargs):
        """
        Registers a callback function to be notified when new message arrives after `message`.

        Warning: In case `callback` as lambda function, saving next step handlers will not work.

        :param message:     The message for which we want to handle new message in the same chat.
        :param callback:    The callback function which next new message arrives.
        :param args:        Args to pass in callback func
        :param kwargs:      Args to pass in callback func
        """
        chat_id = message.chat.id
        self.register_next_step_handler_by_chat_id(chat_id, callback, *args, **kwargs)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Krostelev, 2020-10-13
@twistfire92

You made a mistake with the method.
register_next_step_handler is used to make the bot wait for a specific message from the user, for example, you can expect the next message to be a username or date of birth. It is described in more detail in the same github where you got this function from.
Go here
Most likely this method will not help in solving your problem, but it is useful to get acquainted with it, especially since it is used often.
Directly in a chat with a bot, technical support will not be able to answer on behalf of the bot. Private chats are private chats. There are only 2 users. User and bot. In your last question, I already said that if you want to connect an operator in the same chat, you can try turning the bot into a so-called intermediary. Both the support operator and the user will write messages to the bot, which, in turn, will redirect them to the interlocutor.

S
soremix, 2020-10-13
@SoreMix

You don't need this feature if you are using an inline keyboard.
How to use it is in the library repository
https://github.com/eternnoir/pyTelegramBotAPI/blob...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question