mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge pull request #760 from HolidayMan/patch-1
Some clarification of custom listeners working
This commit is contained in:
commit
6e6420a331
@ -466,7 +466,10 @@ The TeleBot constructor takes the following optional arguments:
|
|||||||
TeleBot should execute message handlers on it's polling Thread.
|
TeleBot should execute message handlers on it's polling Thread.
|
||||||
|
|
||||||
### The listener mechanism
|
### 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
|
```python
|
||||||
def handle_messages(messages):
|
def handle_messages(messages):
|
||||||
for message in messages:
|
for message in messages:
|
||||||
|
Loading…
Reference in New Issue
Block a user