From 9f0ad2d40489346fe0c419f9a8df76688f4a1389 Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Wed, 1 Apr 2026 08:05:10 +0000 Subject: [PATCH] Refactor to apps/ structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JIGAIDO is now a platform with apps/ as the container. All telegram-bot files moved to apps/telegram-bot/: - bot.py, commands.py, cron.py, db.py, schema.sql - requirements.txt, .env.example, README.md - Root now holds SPEC.md, README.md, CONTRIBUTING.md only. Structure: jigaido/ ├── apps/ │ └── telegram-bot/ └── SPEC.md, README.md, CONTRIBUTING.md --- .gitignore | 3 - README.md | 65 ++++--------------- SPEC.md | 17 +++-- apps/telegram-bot/.env.example | 2 + apps/telegram-bot/README.md | 44 +++++++++++++ apps/telegram-bot/__init__.py | 0 bot.py => apps/telegram-bot/bot.py | 0 commands.py => apps/telegram-bot/commands.py | 0 cron.py => apps/telegram-bot/cron.py | 0 db.py => apps/telegram-bot/db.py | 0 .../telegram-bot/requirements.txt | 0 schema.sql => apps/telegram-bot/schema.sql | 0 12 files changed, 70 insertions(+), 61 deletions(-) create mode 100644 apps/telegram-bot/.env.example create mode 100644 apps/telegram-bot/README.md create mode 100644 apps/telegram-bot/__init__.py rename bot.py => apps/telegram-bot/bot.py (100%) rename commands.py => apps/telegram-bot/commands.py (100%) rename cron.py => apps/telegram-bot/cron.py (100%) rename db.py => apps/telegram-bot/db.py (100%) rename requirements.txt => apps/telegram-bot/requirements.txt (100%) rename schema.sql => apps/telegram-bot/schema.sql (100%) diff --git a/.gitignore b/.gitignore index 2da6596..b8a13c6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,9 +9,6 @@ __pycache__/ venv/ env/ -# Database -*.db - # Logs *.log diff --git a/README.md b/README.md index 15dce24..790bc09 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,13 @@ > Named after Nanami Kento's Cursed Technique restriction. Suppresses power during normal hours, exerts it during overtime. -A lightweight bounty tracker for Telegram groups and individuals. Track obligations, deadlines, and tasks with optional reminders. +A bounty tracking platform. Currently ships with a Telegram bot for managing and tracking bounties in groups and DMs. -## Features +## Apps + +- **[Telegram Bot](./apps/telegram-bot/)** — Group and personal bounty tracking via Telegram commands, with due date reminders + +## Overview - **Group bounties**: Each Telegram group has its own bounty list - **Personal bounties**: Private DM bounty list for individuals @@ -13,60 +17,19 @@ A lightweight bounty tracker for Telegram groups and individuals. Track obligati - **Due date reminders**: Daily cron notifies users when bounties are due within 7 days - **Free-form dates**: Natural language due dates (`"tomorrow"`, `"in 3 days"`, `"april 15"`) - **Link deduplication**: No duplicate links within the same group -- **Zero infrastructure**: SQLite + Python, deploys on any $5 VPS - -## Quick Start - -```bash -# Install dependencies -pip install -r requirements.txt - -# Set bot token -export JIGAIDO_BOT_TOKEN="your:token_here" - -# Initialize database and start bot -python bot.py -``` - -## Commands - -| Command | Where | Who | Description | -|---|---|---|---| -| `/bounty` | Group / DM | Anyone | List all bounties | -| `/my` | Group / DM | Anyone | List your tracked bounties | -| `/add [link] [due]` | Group | Admin | Add bounty | -| `/add [link] [due]` | DM | Anyone | Add personal bounty | -| `/update [text] [link] [due]` | Group | Admin | Update bounty | -| `/delete ` | Group | Admin | Delete bounty | -| `/track ` | Group / DM | Anyone | Track a bounty | -| `/untrack ` | Group / DM | Anyone | Stop tracking | -| `/admin_add ` | Group | Creator | Promote to admin | -| `/admin_remove ` | Group | Creator | Demote admin | -| `/start` | Group / DM | Anyone | Re-initialize | -| `/help` | Anywhere | Anyone | Show help | - -## Reminders - -Schedule a daily cron job: - -```bash -# crontab -e -0 9 * * * cd /path/to/jigaido && JIGAIDO_BOT_TOKEN="your:token" python -m cron -``` - -Or via systemd timer (see `cron.py`). ## Project Structure ``` jigaido/ -├── bot.py # Telegram bot entrypoint -├── db.py # SQLite database wrapper -├── schema.sql # Database schema -├── cron.py # Daily reminder job -├── commands.py # Command handlers -├── requirements.txt -└── SPEC.md # Full specification +├── apps/ +│ └── telegram-bot/ ← first app (Python) +│ ├── bot.py +│ ├── commands.py +│ ├── cron.py +│ ├── db.py +│ └── requirements.txt +└── SPEC.md ← full design specification ``` ## License diff --git a/SPEC.md b/SPEC.md index 493ec0f..584a122 100644 --- a/SPEC.md +++ b/SPEC.md @@ -31,14 +31,17 @@ JIGAIDO is a Telegram bot that lets groups and individuals track bounties — ta ``` jigaido/ -├── bot.py # Telegram bot entrypoint, command handlers -├── db.py # SQLite wrapper -├── schema.sql # Database schema -├── cron.py # Daily reminder job -├── requirements.txt -├── .gitignore -├── README.md +├── apps/ +│ └── telegram-bot/ # Telegram bot app +│ ├── bot.py # Entrypoint +│ ├── commands.py # Command handlers +│ ├── cron.py # Daily reminder job +│ ├── db.py # SQLite wrapper +│ ├── schema.sql # Database schema +│ ├── requirements.txt +│ └── .env.example ├── SPEC.md # This document +├── README.md └── CONTRIBUTING.md ``` diff --git a/apps/telegram-bot/.env.example b/apps/telegram-bot/.env.example new file mode 100644 index 0000000..53d4e4a --- /dev/null +++ b/apps/telegram-bot/.env.example @@ -0,0 +1,2 @@ +# Telegram Bot Token (get from @BotFather) +JIGAIDO_BOT_TOKEN= diff --git a/apps/telegram-bot/README.md b/apps/telegram-bot/README.md new file mode 100644 index 0000000..bca6458 --- /dev/null +++ b/apps/telegram-bot/README.md @@ -0,0 +1,44 @@ +# Telegram Bot + +A Telegram bot for managing and tracking bounties in groups and DMs. + +## Setup + +```bash +cd apps/telegram-bot +cp .env.example .env +# Edit .env and add your bot token +pip install -r requirements.txt +``` + +## Run + +```bash +python bot.py +``` + +## Reminders + +Schedule a daily cron job: + +```bash +# crontab -e +0 9 * * * cd /path/to/jigaido/apps/telegram-bot && JIGAIDO_BOT_TOKEN="..." python cron.py +``` + +## Commands + +| Command | Where | Who | Description | +|---|---|---|---| +| `/bounty` | Group / DM | Anyone | List all bounties | +| `/my` | Group / DM | Anyone | List your tracked bounties | +| `/add [link] [due>` | Group | Admin | Add bounty | +| `/add [link] [due>` | DM | Anyone | Add personal bounty | +| `/update [text] [link] [due>` | Group | Admin | Update bounty | +| `/delete ` | Group | Admin | Delete bounty | +| `/track ` | Group / DM | Anyone | Track a bounty | +| `/untrack ` | Group / DM | Anyone | Stop tracking | +| `/admin_add ` | Group | Creator | Promote to admin | +| `/admin_remove ` | Group | Creator | Demote admin | +| `/start` | Group / DM | Anyone | Re-initialize | +| `/help` | Anywhere | Anyone | Show help | diff --git a/apps/telegram-bot/__init__.py b/apps/telegram-bot/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bot.py b/apps/telegram-bot/bot.py similarity index 100% rename from bot.py rename to apps/telegram-bot/bot.py diff --git a/commands.py b/apps/telegram-bot/commands.py similarity index 100% rename from commands.py rename to apps/telegram-bot/commands.py diff --git a/cron.py b/apps/telegram-bot/cron.py similarity index 100% rename from cron.py rename to apps/telegram-bot/cron.py diff --git a/db.py b/apps/telegram-bot/db.py similarity index 100% rename from db.py rename to apps/telegram-bot/db.py diff --git a/requirements.txt b/apps/telegram-bot/requirements.txt similarity index 100% rename from requirements.txt rename to apps/telegram-bot/requirements.txt diff --git a/schema.sql b/apps/telegram-bot/schema.sql similarity index 100% rename from schema.sql rename to apps/telegram-bot/schema.sql