A simple Telegram bot to manage and track group balances (e.g., for shared Spotify subscriptions) using Python. This bot is designed for all the friends who end up paying subscriptions for others. Instead of manually keeping track of everyone’s balances, the bot automatically manages payments, updates reports, and reminds the group when it’s time to settle up. You can also add and remove users easily.
(Yes, I built it because I was that friend too!)
- Add a fixed amount to all users automatically every month
- Subtract payments from individual users
- Show the balance for a single user or all users
- Add or delete users
- Uses a JSON file for persistent storage
-
Clone the repository
-
Install dependencies
pip install -r requirements.txt
-
Update the following global variables as you need in
python_telegram_bot.pyTOKEN=your_telegram_bot_token GROUP_ID=your_group_id IMPORT = 3.50 CURRENCY = "$" DAY = your_payday
-
Create a
balances.jsonfile (or use the provided one) with the initial balances, e.g.:{ "Alice": 0, "Bob": 0, "Charlie": 0 } -
Run the bot
python3 python_telegram_bot.py
- /add_amount - Add an amount to a user
- /subtract_amount - Subtract an amount from a user
- /balance - Show the balance for a user
- /all_balances - Show all balances
- /add_user [initial_balance] - Add a new user
- /remove_user - Remove a user
- /help - Show this help message
- The bot will automatically add the import to all users on the payday that you specified each month.
- Make sure the bot is an admin in your group to send messages.
- Hosting: You need to run it on a Raspberry Pi or on a hosting service to keep it online.
- If you want to contribute, I'll be glad to consider your improvements!
Made with ❤️ by Marcop-00