https://github.com/cyberscoper/genkit-telegram
https://github.com/cyberscoper/genkit-telegram
firebase gemini-api genkit google googlegemini javascript pm2 telegram telethon
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cyberscoper/genkit-telegram
- Owner: CyberScoper
- License: apache-2.0
- Created: 2025-04-04T22:09:21.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-04-05T00:29:22.000Z (7 months ago)
- Last Synced: 2025-10-08T07:41:54.206Z (11 days ago)
- Topics: firebase, gemini-api, genkit, google, googlegemini, javascript, pm2, telegram, telethon
- Language: JavaScript
- Homepage: https://cyberscope360.com/
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Genkit Telegram Assistant
A fully autonomous Telegram userbot that behaves like a human in group chats.
Built with [gramjs](https://github.com/gram-js/gramjs) for user-mode Telegram access, and [Genkit](https://github.com/firebase/genkit) for AI-powered reply generation via Google Gemini models.
---
## ๐ง What it does
- Joins as a real Telegram user
- Replies only when:
- You reply to **its messages**
- You **mention** it by @username
- Occasionally jumps in with a random opinion, like a tired sarcastic cyclist
- Typing style looks human: lowercase, slang, short phrases, some "hmm" or "xะท"
- Respects context of message threads (last 2 messages)
- Custom prompt for both replies and self-comments---
## โ๏ธ Requirements
- Node.js v18+
- Google Gemini API key
- Telegram API ID and Hash from https://my.telegram.org---
## ๐ Setup
1. **Clone this repo**:
```bash
git clone https://github.com/CyberScoper/genkit-telegram.git
cd genkit-telegram
```2. **Install dependencies**:
```bash
npm install
```3. **Create `.env` file**:
```dotenv
API_ID=your_telegram_api_id
API_HASH=your_telegram_api_hash
GOOGLE_API_KEY=your_google_gemini_api_key
RESPONSE_DELAY_MULTIPLIER=50
MIN_MESSAGE_LENGTH=5
RANDOM_COMMENT_CHANCE=0.01
```4. **Run the assistant**:
```bash
npm start
```๐ On first run, you'll be asked to enter your phone, confirmation code, and 2FA password if enabled.
---
## ๐ Environment variables
| Variable | Description |
|--------------------------|------------------------------------------------------|
| `API_ID` | Telegram API ID |
| `API_HASH` | Telegram API Hash |
| `GOOGLE_API_KEY` | Your Gemini Pro API Key |
| `RESPONSE_DELAY_MULTIPLIER` | Milliseconds per character in delay simulation |
| `MIN_MESSAGE_LENGTH` | Ignore messages shorter than this |
| `RANDOM_COMMENT_CHANCE` | Probability of spontaneous message (0.0 - 1.0) |---
## ๐งโ๐ป Run with PM2
```bash
npm install -g pm2
pm2 start user-ai-assistant.js --name telegram-ai
pm2 save
pm2 startup
```Logs:
```bash
pm2 logs telegram-ai
```---
## ๐ค Prompt Logic
- `reply` mode: mimics your human tone, keeps it casual
- `comment` mode: serious yet informal, makes occasional unsolicited remarks
- Will **never mention location**, **never act like an assistant**, and keeps all responses short---
## โ Example use case
Create a Telegram group of cyclists, invite your AI-powered human-looking friend.
Let it observe. When pinged, it responds casually. Occasionally it drops a thoughtful remark. Nobody suspects.---
Made with ๐ป, ๐ค, and ๐ by @cyberscope