No description
Find a file
2026-05-22 06:29:58 +00:00
src Use local personality file example 2026-05-22 06:27:11 +00:00
.env.example Use local personality file example 2026-05-22 06:27:11 +00:00
.gitignore Use local personality file example 2026-05-22 06:27:11 +00:00
AGENTS.md Initial Telegram AI bot 2026-05-22 06:01:00 +00:00
package-lock.json Initial Telegram AI bot 2026-05-22 06:01:00 +00:00
package.json Initial Telegram AI bot 2026-05-22 06:01:00 +00:00
personality.md.example Updated personality example 2026-05-22 06:28:46 +00:00
README.md Updated README.md example 2026-05-22 06:29:58 +00:00

Marvin Telegram Bot

Simple Telegram bot server that sends your Telegram messages to Gemini and replies back. OpenRouter can be configured as a fallback. Recent conversation memory is stored persistently in SQLite.

Setup

  1. Copy the environment file:
cp .env.example .env
  1. Edit .env and add:
TELEGRAM_BOT_TOKEN=...
GEMINI_API_KEY=...
OPENROUTER_API_KEY=...

Gemini is the primary provider. OpenRouter is optional, but useful as fallback.

Get keys from:

https://aistudio.google.com/app/apikey
https://openrouter.ai/keys
  1. Define the bot personality in personality.md.

Example:

You are Marvin, a funny, slightly sarcastic assistant. Keep replies short and playful.

Optional settings in .env:

GEMINI_MODEL=gemini-2.5-flash-lite
OPENROUTER_MODEL=openrouter/free
PERSONALITY_FILE=personality.md
MEMORY_DB=marvin.sqlite
MAX_HISTORY_MESSAGES=20

Memory

Marvin stores chat messages and long-term memories in SQLite at marvin.sqlite by default.

The AI receives:

  • the most recent MAX_HISTORY_MESSAGES chat messages
  • all long-term memories for the current Telegram chat

Recent chat history commands:

/forget

Long-term memory commands:

/remember location = Zagreb
/memories
/forget_memory location
/forget_memories
  1. Start the bot:
npm start

Then open Telegram and message your bot.