This project is a Telegram bot that enables users to chat anonymously. It features a referral system where each user can generate a unique referral link (without revealing their Telegram ID), profile creation (e.g., setting gender), and random anonymous chat options with filtering.
Note: The bot supports various message types (text, stickers, photos, files, voice messages, videos, etc.) by copying messages so that the sender’s identity remains hidden.
- Anonymous Chat: Chat with random users without revealing your personal details.
- Referral System: Generate a unique referral code and share your referral link without exposing your Telegram user ID.
- Profile Management: Set up your profile (e.g., gender) for filtered random chats.
- Multi-type Messaging: All message types (text, photo, sticker, video, etc.) are forwarded/copyed anonymously.
- Database Integration: Uses quick.db with JsonDriver for storing non-sensitive data like profiles and referral codes.
- Node.js (v14 or higher recommended)
- Telegram Bot Token: Create a bot via BotFather and obtain your bot token.
git clone https://github.com/yourusername/anonymous-chat-bot.git
cd anonymous-chat-bot
npm install
Create a .env
file in the root directory. Make sure to provide values for at least token
and database_type
.
Below is an example configuration:
# Bot token (required)
token="YOUR_TELEGRAM_BOT_TOKEN"
# Database type (required): options are "mysql" | "sql" | "mongodb" | "json"
database_type="json"
# (Optional) If using MongoDB:
database_mongoURL="your-mongo-url"
# (Optional) If using MySQL:
database_msql_host="your-mysql-host"
database_msql_user="your-mysql-user"
database_msql_password="your-mysql-password"
database_msql_database="your-mysql-database"
# Support server invite link (optional)
support_url="https://discord.gg/yourInvite"
# Source owners (optional, comma-separated list of owner IDs)
owners='["123456789", "987654321"]'
# Anti crash controller (optional)
anti_crash="true"
# Send console errors to Discord (optional)
logger="true"
You can run the bot in development mode using ts-node
:
npm start
Or compile the TypeScript code to JavaScript and run it:
npm run build
node dist/index.js
Command | Description | Emoji |
---|---|---|
/start |
Starts the bot. Without parameters, it shows usage instructions. With a referral parameter (<referralCode> ), it connects you with a partner. |
🚀 |
/stop |
Stops the current chat session and removes you from any waiting queues. | ✋ |
Package | Version | Description | Emoji |
---|---|---|---|
telegraf | ^4.16.3 | Telegram bot framework for interacting with the Telegram Bot API. | 🤖 |
dotenv | ^16.4.7 | Loads environment variables from a .env file. |
🌱 |
quick.db | ^9.1.7 | A simple SQLite-based database using JsonDriver for storing bot data. | 🗄️ |
colors | ^1.4.0 | Adds color support to console messages, making debugging output more visually appealing. | 🎨 |
write-file-atomic | ^6.0.0 | Provides atomic writing to a file to ensure data integrity during writes. | 💾 |
@types/node | ^22.5.0 | TypeScript definitions for Node.js, providing type checking and IntelliSense for Node.js APIs. | 📚 |
ts-node | ^10.9.2 | Runs TypeScript files directly without needing to compile them first. | ⚡ |
tsup | ^8.2.4 | A bundler for TypeScript projects that provides fast and simple builds. | 📦 |
tslib | ^2.8.1 | Contains runtime helpers for TypeScript to reduce output size. | 🔧 |
typescript | ^5.5.4 | A superset of JavaScript that compiles to plain JavaScript and provides static type checking. | 💻 |
This project is licensed under the BSD 3-Clause License.
- Ensure your
.env
file is properly configured with at least thetoken
anddatabase_type
values. - Run
npm install
to install all dependencies. - Start your bot using
npm start
(or build and run the compiled JavaScript).
Enjoy using the Anonymous Chat Bot and feel free to extend its functionality as needed!