Skip to content

cuong3/gogo-learn

Repository files navigation

gogo-learn bot

overview

a Telegram bot that turns YouTube links into bite-sized learning snippets via Gemini, with SQLite persistence. Allow users to learn from videos anywhere, anytime, at their convinience.

Examples

image image
  • include cost report for each note *
image

setup

./setup.sh (or uv sync) → source .venv/bin/activate.

Before using this, you need to chat with BotFather on Telegram to create a new bot. Add the bot name and token in .env file.

You also need a Gemini dev API for the LLM part.

Finally, find your Telegram chat id by sending a message to the bot and observe the log and add that to allowed list.

.env file

TELEGRAM_BOT_USERNAME=
TELEGRAM_BOT_TOKEN=
GEMINI_API_KEY=
ALLOWED_CHAT_IDS=

Run bot locally

uv run python bot.py

Telegram usage

- /start → help text shown.
- Send a single short YouTube link (e.g. a 2-min video) → expect
"Watching" → "Note ready" → 5–15 snippet messages.
- Send a message with 3 mixed links (youtu.be + watch?v= + shorts) →
expect 3 sequential processing flows, each producing snippets.
- Write something along with the links to steer learning focus in the note generation process. Example '[url1] [url2] summarize key marketing tips in all these videos'.
- Send "hello" → expect "No YouTube links detected."
- /status → shows correct counts.

deploy to fly.io

one-time setup

fly auth login                          # if not already
fly launch --no-deploy --copy-config    # uses existing fly.toml; pick a unique app name if "gogolearn-bot" is taken
fly volumes create gogolearn_data --region sea --size 1   # SQLite lives at /data/gogolearn.db

Create a .env file in the project root with your secrets. Push secrets and deploy:

./deploy.sh --secrets   # loads .env → fly secrets set, then fly deploy

subsequent deploys

./deploy.sh             # fly deploy only (secrets already set)
./deploy.sh --secrets   # re-push secrets + deploy (e.g. after rotating keys)

pushing secrets without deploying

python set_fly_secrets.py   # reads .env and runs fly secrets set

operate

fly logs              # tail
fly status            # machine state
fly ssh console       # shell into the VM (DB at /data/gogolearn.db)
fly scale count 0     # stop/turn down the deployment
fly scale count 1     # this is a polling bot — keep exactly 1 machine

notes

  • fly.toml mounts the gogolearn_data volume at /data and sets GOGOLEARN_DB=/data/gogolearn.db so the SQLite file survives deploys/restarts.
  • No [http_service] block — the bot uses Telegram long-polling, so no public port is needed.
  • Run a single machine. Multiple machines polling the same bot token will conflict.
  • Never commit .env — it is listed in .gitignore.

About

LLM agent to digest youtube video into learning snippets and send to Telegram so you can learn on the go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors