telegram bot for code genie
=======
In .env_dev
file save the following vars:
BOT_TOKEN_DEV
: The telegram bot token for full control. Example: **123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi_jklmnopqrstuvwx
**SERVER_URL_DEV
: The backend server url for making requests. Example: http://localhost:8000/"
In .env_prod
file save the following vars:
BOT_TOKEN_PROD
: The telegram bot token for full control. Example: **123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi_jklmnopqrstuvwx
**SERVER_URL_PROD
: The backend server url for making requests. Example: http://localhost:8000/"
To load environment variables from a .env
file in Python, you can use the python-dotenv
package. Here’s how you can do it:
- Save an
.env
file in your project. WARNING: make sure it is found in.gitignore
. Save the above Variables in the.env
file using the exact provided names. - Install the
python-dotenv
package (if you haven’t already):pip install python-dotenv
- A brief example on how to load a specific environment variable:
import os from dotenv import load_dotenv load_dotenv('.env') bot_token = os.getenv('BOT_TOKEN')
Run command for genie_bot :
-
To run in dev env:
python genie_bot.py dev #or python genie_bot.py
-
To run in production env:
python genie_bot.py prod
├── code-genie-bot \
│ # Package initialization \
│ # Main bot entry point \
│ ├── config\
│ │ # managing and loading configuration settings
│ ├── handlers \
│ │ # Handlers package initialization \
│ │ # Handle bot commands \
│ ├── utils \
│ │ # Utils package initialization \
│ │ # Helper functions \
│ │ # Input validation \
├── tests \
│ # Tests package initialization \
│ # Handlers tests \
│ # Utils tests \
├ # Environment variables \
├ # Git ignore file \
├ # requermint list \
├ # readme