Added information in webhook guide
This commit is contained in:
parent
d640a21a5d
commit
a6105e4fb1
22
README.md
22
README.md
@ -47,7 +47,7 @@ Check out `help(Bot)` for detailed information.
|
|||||||
## Webhook additional information
|
## Webhook additional information
|
||||||
To run a bot in webhook modality, you have to provide a `hostname` and `certificate` at bot instantiation and a `local_host` and `port` when calling `Bot.run` method.
|
To run a bot in webhook modality, you have to provide a `hostname` and `certificate` at bot instantiation and a `local_host` and `port` when calling `Bot.run` method.
|
||||||
* Telegram will send POST requests at `https://{hostname}/webhook/{tokens}/` using `certificate` for encryption
|
* Telegram will send POST requests at `https://{hostname}/webhook/{tokens}/` using `certificate` for encryption
|
||||||
* `aiohttp.web.Application` server will listen `http://{local_host}:{port}` for updates
|
* `aiohttp.web.Application` server will listen on `http://{local_host}:{port}` for updates
|
||||||
|
|
||||||
It is therefore required a reverse proxy passing incoming requests to local_host.
|
It is therefore required a reverse proxy passing incoming requests to local_host.
|
||||||
|
|
||||||
@ -71,9 +71,27 @@ server {
|
|||||||
|
|
||||||
**Example of python configuration file in this situation**
|
**Example of python configuration file in this situation**
|
||||||
```python
|
```python
|
||||||
# File config.py, gitignored and imported in main script
|
# File data/config.py, gitignored and imported in main script
|
||||||
hostname = "https://www.example.com:8553/telegram"
|
hostname = "https://www.example.com:8553/telegram"
|
||||||
certificate = "/path/to/fullchain.pem"
|
certificate = "/path/to/fullchain.pem"
|
||||||
local_host = "127.0.0.5"
|
local_host = "127.0.0.5"
|
||||||
port = 8552
|
port = 8552
|
||||||
|
|
||||||
|
# Main script
|
||||||
|
from data.config import hostname, certificate, local_host, port
|
||||||
|
from data.passwords import bot_token
|
||||||
|
from davtelepot.bot import Bot
|
||||||
|
|
||||||
|
my_bot = Bot(
|
||||||
|
token=bot_token,
|
||||||
|
hostname=hostname,
|
||||||
|
certificate=certificate
|
||||||
|
)
|
||||||
|
|
||||||
|
# ...
|
||||||
|
|
||||||
|
Bot.run(
|
||||||
|
local_host=local_host,
|
||||||
|
port=port
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
@ -7,7 +7,7 @@ __author__ = "Davide Testa"
|
|||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "2.0.5"
|
__version__ = "2.0.6"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user