|
@@ -47,7 +47,7 @@ Check out `help(Bot)` for detailed 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.
|
|
|
* 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.
|
|
|
|
|
@@ -71,9 +71,27 @@ server {
|
|
|
|
|
|
**Example of python configuration file in this situation**
|
|
|
```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"
|
|
|
certificate = "/path/to/fullchain.pem"
|
|
|
local_host = "127.0.0.5"
|
|
|
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
|
|
|
+)
|
|
|
```
|