A substitute for the default Telegram integration on Dialogflow that supports advanced features:
- inline queries;
- incoming voice messages;
Before running it, you need the right version of the libraries needed.
You have to run pip install -r requirements.txt
in the project directory.
Also, if you want to use wit.ai for incoming voice messages, you have to install ffmpeg with libmp3lame
codecs.
If you want to run the script locally, just type in your terminal:
python3 run.py --TELEGRAM_TOKEN [your token] --DIALOGFLOW_KEY [your key] [optional arguments]
You should consider to create an init script if you want to run it on production.
In order to set your bot you will need to pass as arguments:
Argument | Required? | Description | Defaults |
---|---|---|---|
--TELEGRAM_TOKEN | ✔️ | Define Telegram bot Token | Mandatory |
--DIALOGFLOW_KEY | ✔️ | Define Dialogflow Key Path | Mandatory |
--ADMIN_CHAT_ID | ❌ | Define Telegram admin chatIDs | [] |
--WIT_TOKEN | ❌ | Define Wit Token | None |
--LANG | ❌ | Language of the bot; it follows the rfc1766 specification. | en |
--log | ❌ | Set logging value | DEBUG |
If you want telegram notifications every time the script will be shut down / turned up you need to set the ADMIN_CHAT_ID
.
You can set the ADMIN_CHAT_ID
with multiple arguments, for example: --ADMIN_CHAT_ID 12345 54321
.
You can also change the log level: consider using INFO
in production and DEBUG
for debugging purposes.
Before submitting new pull requests, ensure that your code follows the PEP 8 style guide and run pylint3 to find bad practices.
It is recommended to sign every commit with your PGP key, if you have one.