Information updated
This commit is contained in:
parent
8ab1ec4461
commit
925c03b1ed
23
README.md
23
README.md
@ -1,7 +1,7 @@
|
|||||||
# davtelepot
|
# davtelepot
|
||||||
This project conveniently mirrors the Telegram bot API with the class `Bot`.
|
This project conveniently mirrors the Telegram bot API with the class `Bot`.
|
||||||
|
|
||||||
Please note that you need Python3.5+ to run async code.
|
Please note that Python3.5+ is needed to run async code.
|
||||||
|
|
||||||
Check requirements.txt for third party dependencies.
|
Check requirements.txt for third party dependencies.
|
||||||
|
|
||||||
@ -9,21 +9,21 @@ Check out `help(Bot)` for detailed information.
|
|||||||
|
|
||||||
## Project folders
|
## Project folders
|
||||||
|
|
||||||
### data folder
|
### `davtelepot/data` folder
|
||||||
* `*.db`: databases used by bots
|
* `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)
|
* `*.log`: log files (store log_file_name and errors_file_name in `data/config.py` module)
|
||||||
* `passwords.py`: contains secret information to be git-ignored (e.g. bot tokens)
|
|
||||||
|
|
||||||
```
|
### `examples` folder
|
||||||
my_token = 'token_of_bot1'
|
This folder contains full-commented and ready-to-run examples for simple davtelepot.bot Telegram bots.
|
||||||
my_other_token = 'token_of_bot2'
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
```
|
```
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from davtelepot.bot import Bot
|
from davtelepot.bot import Bot
|
||||||
|
|
||||||
from data.passwords import my_token, my_other_token
|
from data.passwords import my_token, my_other_token
|
||||||
|
|
||||||
long_polling_bot = Bot(token=my_token, database_url='my_db')
|
long_polling_bot = Bot(token=my_token, database_url='my_db')
|
||||||
@ -39,7 +39,10 @@ async def foo_command(bot, update, user_record):
|
|||||||
async def bar_command(bot, update, user_record):
|
async def bar_command(bot, update, user_record):
|
||||||
return "Foo!"
|
return "Foo!"
|
||||||
|
|
||||||
exit_state = Bot.run()
|
exit_state = Bot.run(
|
||||||
|
local_host='127.0.0.5',
|
||||||
|
port=8552
|
||||||
|
)
|
||||||
sys.exit(exit_state)
|
sys.exit(exit_state)
|
||||||
```
|
```
|
||||||
Check out `help(Bot)` for detailed information.
|
Check out `help(Bot)` for detailed information.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user