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6
2.2.5
2.2.3
2.2.2
2.2.1
2.2.0
2.1.9
2.1.8
2.1.7
2.1.6
2.1.5
2.1.4
2.1.36
2.1.35
2.1.34
2.1.33
2.1.32
2.1.31
2.1.30
2.1.3
2.1.29
2.1.28
2.1.27
2.1.26
2.1.25
2.1.24
2.1.23
2.1.22
2.1.21
2.1.20
2.1.2
2.1.19
2.1.18
2.1.17
2.1.16
2.1.15
2.1.14
2.1.11
2.1.10
2.1.1
2.1.0
2.0.9
2.0.8
2.0.7
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.10
2.0.1
2.0
1.5.9
1.5.7
1.5.6
1.5.5
1.5.4
1.5.3
1.5.2
1.5.1
1.5.0
1.4.9
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.25
1.4.24
1.4.23
1.4.22
1.4.21
1.4.20
1.4.2
1.4.19
1.4.18
1.4.17
1.4.16
1.4.15
1.4.14
1.4.13
1.4.11
1.4.10
1.4.1
1.4.0
1.3.6
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
توضیحات
Telegram bot API mirroring class, featuring dataset-powered SQLite databases.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | davtelepot-2.9.1 |
| نام | davtelepot |
| نسخه کتابخانه | 2.9.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Davide Testa |
| ایمیل نویسنده | davide@davte.it |
| آدرس صفحه اصلی | https://gogs.davte.it/davte/davtelepot |
| آدرس اینترنتی | https://pypi.org/project/davtelepot/ |
| مجوز | GNU General Public License v3.0 |
# davtelepot
This project conveniently mirrors the Telegram bot API with the class `Bot`.
Please note that Python3.5+ is needed to run async code.
Check requirements.txt for third party dependencies.
Check out `help(Bot)` for detailed information.
## Project folders
### `davtelepot/data` folder
* `config.py` contains configuration settings (e.g. certificate path, local_host, port etc.)
* `passwords.py` contains secret information to be git-ignored (e.g. bot tokens)
* `*.db` files are SQLite databases used by bots
* `*.log`: log files (store log_file_name and errors_file_name in `data/config.py` module)
### `examples` folder
This folder contains full-commented and ready-to-run examples for simple davtelepot.bot Telegram bots.
## Usage
```
import sys
from davtelepot.bot import Bot
from data.passwords import my_token, my_other_token
long_polling_bot = Bot(token=my_token, database_url='my_db')
webhook_bot = Bot(token=my_other_token, hostname='example.com',
certificate='path/to/certificate.pem',
database_url='my_other_db')
@long_polling_bot.command('/foo')
async def foo_command(bot, update, user_record):
return "Bar!"
@webhook_bot.command('/bar')
async def bar_command(bot, update, user_record):
return "Foo!"
exit_state = Bot.run(
local_host='127.0.0.5',
port=8552
)
sys.exit(exit_state)
```
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 on `http://{local_host}:{port}` for updates
It is therefore required a reverse proxy passing incoming requests to local_host.
**Example of nginx reverse proxy serving this purpose**
```nginx
server {
listen 8553 ssl;
listen [::]:8553 ssl;
server_name example.com www.example.com;
location /telegram/ {
proxy_pass http://127.0.0.5:8552/;
}
ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
}
```
**Example of python configuration file in this situation**
```python
# 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
)
```
نیازمندی
| مقدار | نام |
|---|---|
| - | aiohttp |
| - | bs4 |
| - | dataset |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.5 | Python |
نحوه نصب
نصب پکیج whl davtelepot-2.9.1:
pip install davtelepot-2.9.1.whl
نصب پکیج tar.gz davtelepot-2.9.1:
pip install davtelepot-2.9.1.tar.gz