Queer European MD passionate about IT
浏览代码

Added information in webhook guide

Davte 5 年之前
父节点
当前提交
a6105e4fb1
共有 2 个文件被更改,包括 21 次插入3 次删除
  1. 20 2
      README.md
  2. 1 1
      davtelepot/__init__.py

+ 20 - 2
README.md

@@ -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
+)
 ```

+ 1 - 1
davtelepot/__init__.py

@@ -7,7 +7,7 @@ __author__ = "Davide Testa"
 __email__ = "davide@davte.it"
 __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
 __license__ = "GNU General Public License v3.0"
-__version__ = "2.0.5"
+__version__ = "2.0.6"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"