Gastitis is a Telegram bot designed to help you track your expenses easily and efficiently.
Follow these instructions to get a copy of the project up and running on your local machine.
To test or deploy this project, you need to create your own bots via BotFather.
Refer to the Telegram Bot documentation for detailed steps.
It's recommended to create two bots:
- Testing Bot: For use in your development environment.
- Production Bot: For deployment in your live environment.
Prepare a configuration file at gastitis/secret_settings.py
with the following content:
TELEGRAM_BOT_TOKEN = '' # Place your bot token here.
DJANGO_SECRET_KEY = '' # Generate a Django secret key (see https://docs.djangoproject.com/en/4.1/ref/settings/#secret-key).
DATABASE_SETTINGS = None # Use 'None' to run Gastitis with SQLite.
DATABASE_SETTINGS = { # Use these settings for a specific database (e.g., PostgreSQL).
'ENGINE': 'django.db.backends.postgresql',
'NAME': '', # Database name.
'USER': '', # Database username.
'PASSWORD': '', # Database password.
'HOST': '127.0.0.1',
'PORT': '5432',
}
BETA_USERS = ['your_telegram_username'] # List of Telegram usernames allowed to access beta features and commands
Note: For setting up a specific database like PostgreSQL, refer to the Database Setup Guide.
The /export
command requires Google credentials. Follow these steps to set them up:
- Create a Google service account following the gspread documentation.
- Download the credentials JSON file provided by Google.
- Save the JSON file to the following location: gastitis/google_credentials.json.
- Create a virtual environment and activate it:
python3 -m venv env
source env/bin/activate
- Install the required dependencies:
pip install -r requirements.txt
- Apply database migrations:
python manage.py migrate
- Start your bot:
python manage.py startbot
You can now interact with your bot in Telegram! Use /help to see the available commands.
If you want to view the expenses you've added or any other data stored by your bot, you need to create a superuser for the Django admin panel:
- Create a superuser:
python manage.py createsuperuser
- Run the development server:
python manage.py runserver
- Access the admin panel: Open your browser and go to http://localhost:8000/admin. Log in with the superuser credentials you created in the previous step.
You can now explore the data your bot has generated!
Enhance your Telegram bot's functionality by customizing its settings. Follow the instructions in the Bot Manual Settings for detailed guidance.
- After making any changes to the code, please run the functional tests to ensure everything is working as expected.
- If you are adding a new command, follow the instructions in the Create a New Command section.
- Sofía Denner
This project is licensed under the MIT License. See the LICENSE file for details.