2018-10-28 19:35:06 +02:00
|
|
|
.. Autogenerated file at 2018-10-28 19:31:48.335963
|
2018-09-08 02:14:14 +03:00
|
|
|
|
|
|
|
|
=========================
|
|
|
|
|
Adwanced executor example
|
|
|
|
|
=========================
|
|
|
|
|
|
|
|
|
|
!/usr/bin/env python3
|
2018-10-28 19:35:06 +02:00
|
|
|
**This example is outdated**
|
2018-09-08 02:14:14 +03:00
|
|
|
In this example used ArgumentParser for configuring Your bot.
|
|
|
|
|
Provided to start bot with webhook:
|
|
|
|
|
python adwanced_executor_example.py \
|
|
|
|
|
--token TOKEN_HERE \
|
|
|
|
|
--host 0.0.0.0 \
|
|
|
|
|
--port 8084 \
|
|
|
|
|
--host-name example.com \
|
|
|
|
|
--webhook-port 443
|
|
|
|
|
Or long polling:
|
|
|
|
|
python adwanced_executor_example.py --token TOKEN_HERE
|
|
|
|
|
So... In this example found small trouble:
|
|
|
|
|
can't get bot instance in handlers.
|
|
|
|
|
If you want to automatic change getting updates method use executor utils (from aiogram.utils.executor)
|
2018-10-28 19:35:06 +02:00
|
|
|
TODO: Move token to environment variables.
|
2018-09-08 02:14:14 +03:00
|
|
|
|
|
|
|
|
.. literalinclude:: ../../../examples/adwanced_executor_example.py
|
|
|
|
|
:caption: adwanced_executor_example.py
|
|
|
|
|
:language: python
|
|
|
|
|
:linenos:
|
2018-10-28 19:35:06 +02:00
|
|
|
:lines: 25-
|