Skip to content

peterhass/abrechnomat_bot

Repository files navigation

ChatGPT Image May 8, 2025, 08_08_57 PM (1)

AbrechnomatBot

A Telegram bot for bill splitting. Supports an unlimited number of debtors/creditors on a bill and calculates the minimum number of transactions necessary to settle everyone's accounts. The bot supports various currencies and locales, allowing users to manage expenses in their preferred settings. Bill exports are designed for easy import into spreadsheet applications like Google Sheets.

Usage

  • Add the bot to a group (works best with admin privileges)
  • /pay: Initiates the wizard for adding payments
  • /add_payment: Adds a payment for you or another user
  • /revert_payment: Removes a previously added payment
  • /bill_stats: Displays the current totals and required transactions
  • /close_bill: Closes the current bill when all payments are completed (a new bill will start automatically after this). A CSV export of payments will be generated after the bill is closed.
  • /set_locale: Sets internationalization settings, including locale, currency, and time zone
  • /export_payments: Generates a CSV export of payments. The values are formatted for easy import into spreadsheets (e.g., Google Sheets) based on localization settings.

Development Setup

  1. Create the bot through BotFather to obtain the bot API token
  2. Run cp .env.example .env.local
  3. Complete the fields in .env.local
  4. Set up environment variables for the current session using source .env.local
  5. Execute iex -S mix

Deployment

  1. Clone the repository: git clone https://github.com/peterhass/abrechnomat_bot.git repo
  2. Build and set up the service: make build && make service
  3. Update the configuration at: ~/.config/abrechnomat_bot
  4. Initialize the database if needed: DB_CREATE=true ~/.local/share/abrechnomat_bot/bin/abrechnomat_bot start_iex
  5. Start the service: systemctl --user start abrechnomat_bot.service

Updating

  1. Backup the database Mnesia.<username>@<hostname>
  2. Pull the latest changes: git pull
  3. Build and re-install the service: make build && make service
  4. Restart the service systemctl --user restart abrechnomat_bot.service
  5. Check logs: journalctl --user -u abrechnomat_bot.service -r

Ideas / future improvements

  • Generate pre-filled PayPal links for final payments (requires users to configure their PayPal account)
  • Implement a tipping mechanism for the bot provider (possibly post-bill completion)
  • Handle edge cases: Users joining or leaving the group while a bill is open

About

Telegram bot for bill splitting built on Elixir

Topics

Resources

License

Stars

Watchers

Forks