Documentation
This commit is contained in:
parent
fc7da6d1bd
commit
0ac4553591
20
README.md
20
README.md
@ -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.
|
||||
|
@ -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"
|
||||
__version__ = "2.0.1"
|
||||
__maintainer__ = "Davide Testa"
|
||||
__contact__ = "t.me/davte"
|
||||
|
||||
|
@ -2,6 +2,29 @@
|
||||
|
||||
camelCase methods mirror API directly, while snake_case ones act as middlewares
|
||||
someway.
|
||||
|
||||
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()
|
||||
sys.exit(exit_state)
|
||||
```
|
||||
"""
|
||||
|
||||
# Standard library modules
|
||||
|
Loading…
x
Reference in New Issue
Block a user