mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
add apihelper.ENABLE_MIDDLEWARE = True to readme
This commit is contained in:
parent
003a92f466
commit
80c9e17fd4
@ -231,9 +231,11 @@ def test_callback(call):
|
|||||||
|
|
||||||
A middleware handler is a function that allows you to modify requests or the bot context as they pass through the
|
A middleware handler is a function that allows you to modify requests or the bot context as they pass through the
|
||||||
Telegram to the bot. You can imagine middleware as a chain of logic connection handled before any other handlers are
|
Telegram to the bot. You can imagine middleware as a chain of logic connection handled before any other handlers are
|
||||||
executed.
|
executed. Middleware processing is disabled by default, enable it by setting `apihelper.ENABLE_MIDDLEWARE = True`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
apihelper.ENABLE_MIDDLEWARE = True
|
||||||
|
|
||||||
@bot.middleware_handler(update_types=['message'])
|
@bot.middleware_handler(update_types=['message'])
|
||||||
def modify_message(bot_instance, message):
|
def modify_message(bot_instance, message):
|
||||||
# modifying the message before it reaches any other handler
|
# modifying the message before it reaches any other handler
|
||||||
|
Loading…
Reference in New Issue
Block a user