Telegram bot to keep you in touch with running console commands.
Based on this article.
- Create local credentials file and fill it with generated bot API Token and target user id:
cp config/credentials.py.sample config/credentials.py # Linux
copy config/credentials.py.sample config/credentials.py # Windows
- Install virtual environment (if not yet installed):
pip install virtualenv
- Initialize virtual environment (run in project root):
python -m venv botenv/
- Login/activate virtual environment in current terminal:
source botenv/bin/activate # Linux
botenv\Scripts\activate.bat # Windows
- Install project dependencies using requirements.txt
pip install -r requirements.txt
After deploy, run your commands as:
/path/to/notifyme/botenv/bin/python3 /path/to/notifyme/app.py php bin/magento indexer:reindex
NOTE: To receive messages, you have to write at least one message to your bot (have chat available).
For more comfortable usage add this line to ~/.bash_aliases
file:
alias NM="/path/to/notifyme/botenv/bin/python3 /path/to/notifyme/app.py"
NOTE: Do not forget to replace /path/to/notifyme/
with your real path.
After reopening the terminal, aliased command will be available as:
NM php bin/magento indexer:reindex
- Before running any python-related command, activate virtual environment:
source botenv/bin/activate # Linux
botenv\Scripts\activate.bat # Windows
- Save your project dependencies to file:
pip freeze > requirements.txt # dump project dependencies
To set up PyCharm to map your local virtualenv, search for "Python Interpreter" in settings and set project python as an interpreter.
For ShellScript implementation check notifyme repo