Some clarification of custom listeners working

This commit is contained in:
HolidayMan 2020-02-27 00:59:21 +02:00 committed by GitHub
parent e789407774
commit 3ecb7cef3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -466,7 +466,10 @@ The TeleBot constructor takes the following optional arguments:
TeleBot should execute message handlers on it's polling Thread.
### The listener mechanism
As an alternative to the message handlers, one can also register a function as a listener to TeleBot. Example:
As an alternative to the message handlers, one can also register a function as a listener to TeleBot.
NOTICE: handlers won't disappear! Your message will be processed both by handlers and listeners. Also, it's impossible to predict which will work at first because of threading. If you use threaded=False, custom listeners will work earlier, after them handlers will be called.
Example:
```python
def handle_messages(messages):
for message in messages: