CoolFace
Apppublic

yosefMinda/tg-inline-mvp

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
App README

Campaign Study Dashboard Bot

A Telegram bot that manages a 20-day study campaign via a single pinned dashboard message.


Setup

1. Get your credentials

CredentialHow to get it
BOT_TOKENMessage @BotFather on Telegram → /newbot
AIRTABLE_API_KEYairtable.com → Account → Developer Hub → Personal Access Token (scope: data.records:read, data.records:write)
AIRTABLE_BASE_IDOpen your base in browser → URL is airtable.com/YOUR_BASE_ID/...

2. Create the Airtable table

In your Airtable base, create a table named BotState with two fields:

  • Key — Single line text (this is the default primary field, just rename it)
  • Value — Long text

3. Set up your storage channel

  1. 1.Create a public Telegram channel (e.g. @your_study_resources)
  2. 2.Go to Channel Settings → Restrict Saving Content → Enable
  3. 3.Upload your PDFs and audio files as posts
  4. 4.Copy each post's link (t.me/your_study_resources/POST_NUMBER)
  5. 5.Paste those links into MODULES in bot.py

4. Install and run

bash
pip install -r requirements.txt

export BOT_TOKEN="your_bot_token"
export AIRTABLE_API_KEY="your_airtable_pat"
export AIRTABLE_BASE_ID="your_base_id"

python bot.py

5. Add bot to your group

  • Add the bot as an admin to your group (it needs pin message permission)
  • Send /startcampaign — this posts + pins the dashboard and starts the timer

Commands

CommandWhoWhat it does
/startcampaignAdminPosts dashboard, pins it, starts the 20-day clock
/dashboardAdminRe-renders the pinned message in-place (e.g. after editing resources)

How module unlocking works

The bot calculates which module is active purely from campaign_start date:

  • Days 0–4 → Module 1
  • Days 5–9 → Module 2
  • Days 10–14 → Module 3
  • Days 15–19 → Module 4

No cron job needed. Every button click re-checks the date live.


Free hosting options (to keep the bot running 24/7)

  1. 1.Railway — free tier, deploy straight from GitHub
  2. 2.Render — free tier web service (add a dummy HTTP endpoint to keep it alive)
  3. 3.GitHub Actions — not ideal for a polling bot, but works for scheduled tasks

The simplest path: push this repo to GitHub → connect to Railway → set the 3 env vars → deploy.