Random anonymous 1-on-1 chat bot for Telegram with interest-based matching, chat ratings, and anonymous confessions.
- Interest-based matching — users select topics, matched by shared interests
- Chat ratings — rate your chat partner after each conversation (1-5 stars)
- Anonymous confessions & questions — post to a Telegram channel anonymously
- Full media support — text, photo, video, voice, sticker, audio, document, GIF, video note
- Gender selection — male/female before first chat
- Block system — block annoying partners after chat ends
- Anti-spam — 1-minute cooldown between searches
- State machine — Redis-backed user state management
- Runtime: Node.js + TypeScript
- Bot: node-telegram-bot-api
- Database: MongoDB (mongoose)
- State: Redis
kpkchat/
├── src/
│ ├── index.ts # Main entry & message routing
│ ├── db.ts # MongoDB connection
│ ├── config.ts # Redis client & helpers
│ ├── keyboards.ts # Telegram keyboard layouts
│ ├── types.ts # Shared TypeScript types
│ ├── models/
│ │ ├── user.ts # User schema & interests
│ │ ├── chat.ts # Chat message storage
│ │ └── confession.ts # Anonymous confessions
│ └── handlers/
│ ├── start.ts # /start, gender, interests setup
│ ├── search.ts # Random matching with interest filter
│ ├── chat.ts # Message forwarding
│ ├── rating.ts # Post-chat rating & close
│ └── confession.ts # Anonymous confessions/questions
├── package.json
├── tsconfig.json
├── .env.example
└── README.md
- Node.js 18+
- Redis
- MongoDB
- Telegram Bot Token (from @BotFather)
git clone https://github.com/mrfelfel/kpkchat.git
cd kpkchat
npm installcp .env.example .envEdit .env with your tokens. To enable anonymous confessions, create a Telegram channel, add the bot as admin, and set CONFESSION_CHANNEL_ID.
npm run build
npm start
# or dev mode
npm run dev- User sends
/start→ registers if new - Selects gender (once)
- Selects interest topics (up to 5)
- Hits "🔗 وصلم کن!" to search
- Bot matches by shared interests (fallback: any available user)
- Shows shared interest tag on match
- Messages forwarded in real-time
- "🛑 قطع مکالمه" ends chat → both users rate each other
- Optional: block partner after rating
- Set
CONFESSION_CHANNEL_IDin.env - Users tap "💬 اعتراف ناشناس" or "❓ سوال ناشناس"
- Write their text → posted to the channel anonymously
| Variable | Description |
|---|---|
TELEGRAM_BOT_TOKEN |
Bot token from @BotFather |
REDIS_URL |
Redis connection URL |
MONGODB_URI |
MongoDB connection URI |
CONFESSION_CHANNEL_ID |
Channel ID for confessions (optional) |
MIT