Telegram Access Bot
Multi-language Telegram bot for managing access to private channels based on subscription to the main channel. Supports Russian and English languages, automatically detects user's language, and provides appropriate channels.
Contacts: https://t.me/dan_cryptoscan
What you get:
Free setup into your hosting
Free help to integrate app to your server
Full access to the codebase and code updates
Free updates for app, you can request for free updates via access to issues
Full access to Project Time tracking by developers
Features
🌍 Multi-language support (RU/EN)
🔄 Automatic user language detection
🔐 Channel subscription verification
🎯 Single-use invite link generation
📊 User statistics
📨 Message broadcasting system
⏰ Daily reminders for unsubscribed users
Requirements
Node.js 16+
pnpm
Telegram Bot Token (get from @BotFather)
Two channels for each language (public source + private target)
Installation
Clone the repository:
Install dependencies:
Create configuration file:
Configure config.yaml:
Running
Development:
Production:
Bot Commands
User Commands
/start
- Start interaction with the bot/check
- Check subscription status/ref
- Get your personal referral link and statistics/ref [code]
- Check statistics for a specific referral code
Admin Commands
/stats
- Show detailed user statistics/broadcast_all [text]
- Send message to all users/broadcast_subscribed [text]
- Send message to subscribed users/broadcast_unsubscribed [text]
- Send message to unsubscribed users/create_ref [code]
- Create custom referral code (generates random code if not specified)/ref [code]
- Check detailed statistics for any referral code
Referral System
The bot includes a comprehensive referral system that allows users to invite others and track their referral statistics.
Referral Features
Generate personal referral links
Track number of invited users
View detailed referral statistics
Monitor active invitations
Referral Code Management
Administrators can create custom referral codes using:
/create_ref
- Generates a random 6-character code/create_ref customcode
- Creates a referral code with specified name
Examples:
Each referral code can be tracked using /ref [code]
command which shows:
Total number of invited users
Currently active users
Detailed list of invited users with their status
How Referral System Works
Getting Referral Link
Use
/ref
command to get your personal referral linkShare the link with potential users
Inviting Users
When users join via referral link, they're automatically tracked
The system records the referral relationship
Viewing Statistics
Use
/ref
to see your referral statisticsUse
/ref [code]
to check specific referral code statisticsStatistics include total invites and active users
Referral Data Storage
Bot saves referral data in data/referrals.json
:
Referral codes
Invited users list
Total invitation count
Active referrals tracking
Data Structure
User Data (data/users.json
)
data/users.json
)Referral Data (data/referrals.json
)
data/referrals.json
)Channel Setup
Create two channels for each language:
Public channel (source) - must have a username
Private channel (target) - can be private
Add the bot as an administrator to both channels
Get channel IDs:
For public channel, use username with @ (e.g., "@mychannel")
For private channel, get ID via @getidsbot
Private channel ID must start with -100
Statistics and Data
Bot saves user data in data/users.json
:
User ID
Username
First and last name
First interaction date
Access status
Selected language
Statistics include:
Total number of users
Number of subscribed/unsubscribed users
Language distribution
Message Broadcasting
Administrators can send messages to different user groups:
Broadcasting system includes:
Anti-spam protection (delay between messages)
Delivery report (number of successful/failed sends)
Markdown markup support
Daily Reminders
Bot automatically sends reminders to unsubscribed users:
Sent at 12:00 every day
Different messages for each language
Message rotation for variety
Security
Single-use invite links for private channel
Admin rights verification for special commands
Anti-spam protection for broadcasts
Troubleshooting
If you encounter problems:
Check bot permissions in channels
Verify channel IDs are correct
Ensure public channels have usernames
Check error logs in console
License
MIT
Last updated