π¨ IMPORTANT: Python 3.13 Compatible Version
Automated invoice generation system with Telegram bot support, adapted for Python 3.13 and python-telegram-bot 21.8.
- π DOCX invoice generation from Word template
- π Automatic placeholder replacement with data
- π± NBP (National Bank of Poland) exchange rate fetching
- π€ Amount conversion to words (Polish and English)
- π Save to
invoices/folder - π’ Multiple organizations support
- π¬ Gmail listener forwards new emails from configured correspondents to the bot
- π€ Telegram Bot (version 21.8) - FULLY WORKING
- π User access control
- π Jira Work Reports - NEW FEATURE
- β PDF generation (compatibility issues with Python 3.13)
- Python 3.13 (required!)
- pip package manager
- Internet connection for NBP rate fetching
pip install -r requirements.txtIMPORTANT: Template files are provided as examples and need to be customized for your use.
The project includes template files in the resources/ folder:
invoice_template.docx- Invoice generation templatereport_work_template.docx- Jira work report template
Before using:
- Open the templates in Microsoft Word
- Customize them with your company information, logo, and formatting
- Keep the placeholders intact (e.g.,
<date>,<MM>,<yyyy>, etc.) - Save the customized templates with the same filenames
Template Placeholders:
For invoice_template.docx:
<date>,<end_date>,<number>,<amount>,<amount_words>, etc.
For report_work_template.docx:
<MM>- Month number (e.g., 09)<yyyy>- Year (e.g., 2025)(<task>)<title_task>- Will be replaced with actual task list
- Find @BotFather in Telegram
- Send
/newbot - Follow the instructions
- Save the token
python setup.py
# OR directly:
python bot/setup_bot.pypython start_bot.py
# OR directly:
python bot/telegram_bot.py- Enable IMAP access for the Gmail account.
- Create an app password (required when 2FA is enabled).
- Open
config.envand set:ALLOWED_USER_IDSGMAIL_USERNAME,GMAIL_APP_PASSWORD,CORRESPONDENTS,MAIL_CHECK_INTERVAL
- Restart the bot so the new configuration loads.
- β
start_bot.py- Convenience bot launcher - β
setup.py- Convenience setup launcher - β
generate_invoice.py- CLI invoice generator (without PDF) - π
requirements.txt- Dependencies - π
config.env- Configuration (created during setup)
- π€
telegram_bot.py- Main Telegram bot - βοΈ
setup_bot.py- Bot configuration setup - π§ͺ
test_generate.py- Test bot version - π
run_bot.py- Auto-restart bot runner
- π€
number_converter.py- Number to words converter
- π
invoice_template.docx- Invoice template - π
orgs.json- Organization data
Welcome message and basic information
Create invoice
/generate <date> <end_date> <buyer> <recipient> <amount>
Example:
/generate 04.09.2025 14/09/2025 Organization Organization 3000.00
Check system status
List available organizations
Generate Jira work report for a specific month
/report <month>
Examples:
/report september
/report august
/report ijul
Command help
- Date: DD.MM.YYYY (04.09.2025)
- End Date: DD/MM/YYYY (14/09/2025)
- Amount: Number with dot (3000.00)
python generate_invoice.py 04.09.2025 "14/09/2025" "Organization" "Organization" 3000.00generate-invoice/
βββ π bot/ # Telegram bot files
β βββ π€ telegram_bot.py # Main Telegram bot
β βββ βοΈ setup_bot.py # Bot configuration setup
β βββ π§ͺ test_generate.py # Test bot version
β βββ π run_bot.py # Auto-restart bot runner
βββ π converter/ # Conversion utilities
β βββ π€ number_converter.py # Number to words converter
βββ π jira_integration/ # Jira integration
β βββ π jira_report_generator.py # Jira report generator
β βββ __init__.py # Module initialization
βββ π resources/ # Templates and data
β βββ π invoice_template.docx # Invoice template
β βββ π report_work_template.docx # Jira report template
β βββ π orgs.json # Organization data
βββ π invoices/ # Generated invoices (auto-created)
βββ π reports/ # Generated Jira reports (auto-created)
βββ π docs/ # Documentation
β βββ π JIRA_REPORTS_GUIDE.md # Jira reports guide
β βββ π TELEGRAM_BOT_GUIDE.md # Telegram bot guide
βββ π start_bot.py # Convenience bot launcher
βββ βοΈ setup.py # Convenience setup launcher
βββ π§ generate_invoice.py # CLI invoice generator
βββ π requirements.txt # Dependencies
βββ π config.env # Configuration (created during setup)
These placeholders are replaced during invoice generation:
<dd>- Day<mm>- Month<yyyy>- Year<buyer>- Buyer organization data<recipient>- Recipient organization data<summ>- Amount<termin>- Payment deadline<summ_words_polland>- Amount in words (Polish)<summ_words_english>- Amount in words (English)<nbp_kurs>- NBP EUR exchange rate
These placeholders are replaced during report generation:
<MM>- Month number (01-12)<yyyy>- Year (e.g., 2025)(<task>)<title_task>- Task list placeholder (replaced with actual tasks in format:(TASK-123)Task Title)
File resources/orgs.json:
[
{
"name": "YourCompany",
"data": "Your Company Name\\nYour Address\\nBank Details"
}
]Add to bot/config.env:
# Jira Configuration
JIRA_SERVER=https://your-company.atlassian.net
JIRA_USERNAME=your_username@example.com
JIRA_API_TOKEN=your_jira_api_token
JIRA_PROJECT_KEY=PROJECT
REPORT_AUTHOR=Your Name/report september
python jira_integration/jira_report_generator.py september- English: january, february, march, april, may, june, july, august, september, october, november, december
- Abbreviations: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
- Russian (transliterated): janvar, fevral, mart, aprel, maj, ijun, ijul, avgust, sentjabr, oktjabr, nojabr, dekabr
- Connects to Jira using API token
- Searches for tasks where you participated (assignee, reporter, commented)
- Uses template
resources/report_work_template.docx - Replaces
MMwith month number,yyyywith year - Adds tasks in format
(<task>)<title_task> - Saves to
reports/directory
For detailed documentation, see JIRA_REPORTS_GUIDE.md.