GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - vitorgamer58/expense-manager-bot

BranchesTags
Open more actions menu

Latest commit

 

History

29 Commits
29 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.prettierrc
.prettierrc
 
 
README.md
README.md
 
 
eslint.config.mts
eslint.config.mts
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

expense-manager-bot

A Telegram bot for expense tracking. You send it a message, and it extracts the transactions with a Mistral LLM, stores them in MongoDB and replies with what it understood.

Supported inputs:

Input How it is processed
Text extracted directly by the LLM
Photo OCR, then extraction
Audio transcription, then extraction
PDF OCR, then extraction
CSV parsed from the Bolt ride export

Commands: /excelreport returns every entry of the chat as an .xlsx spreadsheet, and /ping replies pong. Each chat is limited to 15 messages per 24 hours, audited in the database.

Architecture

DDD with Clean Architecture, with the dependency rule always pointing inwards:

src/
├── domain/   entities, domain errors, ports (interfaces) and use cases
├── infra/    adapters: Telegram, Mistral, MongoDB, ExcelJS, CSV
└── main/     composition root, the only place that picks concrete implementations
  • Ports & Adapters — the domain only knows interfaces (IAIClient, ITransactionRepository, IExpenseReportWriter, IFileLinkResolver...). Nothing under src/domain imports infra/, telegraf, mongodb, exceljs or zod.
  • Constructor dependency injection, without a container: the object graph is wired in src/main/container.ts.
  • Repository + Data Mapper — explicit mappers translate MongoDB documents into entities and back, keeping the database schema out of the domain.
  • Value Object — Amount validates currency and value, and owns the isExpense() rule.
  • Anti-corruption layer — CsvTransactionParser isolates the format of the Bolt export.
  • Domain errors — use cases throw typed errors, and the bot layer translates them into the messages sent to the user.

Installation

Requires Node 20+, pnpm, a MongoDB instance, a bot created through @BotFather and a Mistral API key.

pnpm install

Create a .env file in the project root:

BOT_TOKEN=your_telegram_token
MISTRAL_API_KEY=your_api_key
MONGO_URL=mongodb://localhost:27017
MONGO_DB_NAME=expense_manager
MAX_FILE_SIZE=5242880
DAILY_MESSAGE_LIMIT=15

MAX_FILE_SIZE (defaults to 5 MB) and DAILY_MESSAGE_LIMIT (defaults to 15) are optional.

pnpm dev        # development with tsx
pnpm build      # compile to dist/
pnpm start      # run the build
pnpm lint-fix   # eslint --fix and prettier

About

No description, website, or topics provided.

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

Generated from vitorgamer58/telegram-bot-example
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.