Telegram Access Bot
Last updated
Last updated
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:
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
🌍 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
Node.js 16+
pnpm
Two channels for each language (public source + private target)
Clone the repository:
Install dependencies:
Create configuration file:
Configure config.yaml:
Development:
Production:
/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
/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
The bot includes a comprehensive referral system that allows users to invite others and track their referral statistics.
Generate personal referral links
Track number of invited users
View detailed referral statistics
Monitor active invitations
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
Getting Referral Link
Use /ref
command to get your personal referral link
Share 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 statistics
Use /ref [code]
to check specific referral code statistics
Statistics include total invites and active users
Bot saves referral data in data/referrals.json
:
Referral codes
Invited users list
Total invitation count
Active referrals tracking
data/users.json
)data/referrals.json
)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")
Private channel ID must start with -100
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
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
Bot automatically sends reminders to unsubscribed users:
Sent at 12:00 every day
Different messages for each language
Message rotation for variety
Single-use invite links for private channel
Admin rights verification for special commands
Anti-spam protection for broadcasts
If you encounter problems:
Check bot permissions in channels
Verify channel IDs are correct
Ensure public channels have usernames
Check error logs in console
MIT
Telegram Bot Token (get from )
For private channel, get ID via