add apihelper.ENABLE_MIDDLEWARE = True to readme

This commit is contained in:
Robin Modisch 2021-01-17 23:22:45 +01:00 committed by GitHub
parent 003a92f466
commit 80c9e17fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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
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
apihelper.ENABLE_MIDDLEWARE = True
@bot.middleware_handler(update_types=['message'])
def modify_message(bot_instance, message):
# modifying the message before it reaches any other handler