Documentation

This commit is contained in:
2019-07-13 18:26:12 +02:00
parent fc7da6d1bd
commit 0ac4553591
3 changed files with 36 additions and 9 deletions

View File

@@ -22,20 +22,24 @@ my_other_token = 'token_of_bot2'
## Usage
```
from davtelepot import Bot
import sys
from davtelepot.bot import Bot
from data.passwords import my_token, my_other_token
my_bot = Bot.get(token=my_token, db_name='my_db')
my_other_bot = Bot.get(token=my_other_token, db_name='my_other_db')
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')
@my_bot.command('/foo')
async def foo_command(update):
@long_polling_bot.command('/foo')
async def foo_command(bot, update, user_record):
return "Bar!"
@my_other_bot.command('/bar')
async def bar_command(update):
@webhook_bot.command('/bar')
async def bar_command(bot, update, user_record):
return "Foo!"
Bot.run()
exit_state = Bot.run()
sys.exit(exit_state)
```
Check out `help(Bot)` for detailed information.