TON Token Access Control Bot is a specialized bot that utilizes NFT tokens and/or Jettons to manage access to your private Telegram chats. This convenient solution allows you to control who has access to your groups and when, using tokens as unique non-transferable identifiers for each participant.
- Bot example: @TONTokenAccessControlBot
-
Token Access Control: Allows access via NFT tokens and Jettons, with customizable token limits.
-
Testnet and Mainnet Support: Flexible testing and deployment on both networks.
-
TON-Connect Integration: Ensures a secure and user-friendly experience.
-
User-Friendly Admin Panel: Built-in panel for easy administration.
-
Multilingual Support: Supports Russian and English for user interaction.
-
Newsletters to All Users: Distributes newsletters to all users, including delayed scheduling.
Preparation and installation
-
Create a private group and/or channel.
-
Create a bot via @BotFather and save the
TOKEN
(later referred to asBOT_TOKEN
). -
Create an API key on tonconsole.com (later referred to as
TONAPI_KEY
). -
Obtain a key for TON Connect (Optional, later referred to as
TONAPI_TONCONNECT_KEY
).This key is necessary for the proper functioning of TON Connect on the backend under heavy user load. You can get the key by contacting @subden via private message. Inform him about your project and the need for this key.
-
Clone the repository:
git clone https://github.com/nessshon/token-access-control-bot.git
-
Navigate to the bot directory:
cd token-access-control-bot
-
Clone the environment variables file:
cp .env.example .env
-
Configure environment variables variables file:
nano .env
-
Install Docker and Docker Compose:
sudo apt install docker.io && docker-compose -y
-
Run the bot in a Docker container:
docker-compose up --build
-
Start the bot with the command
/start
, choose the language, and connect wallet. -
Access the admin panel with the command
/admin
and add the token. -
Add the bot to your private chat, ensuring you grant permissions to add administrators. After that, the bot will prompt you to add the chat to the database for monitoring.
-
You're all set!
Customize the bot's texts in the texts file according to your requirements. Additionally, if desired, add your preferred language to SUPPORTED_LANGUAGES and insert the corresponding codes into TEXT_BUTTONS and TEXT_MESSAGES.
Click to expand
Here's a comprehensive reference guide for the environment variables used in the project:
Variable | Type | Description | Example |
---|---|---|---|
BOT_TOKEN |
str |
Bot token obtained from @BotFather | 123456:qweRTY |
BOT_DEV_ID |
int |
User ID of the bot developer, obtain it from my_id_bot | 123456789 |
BOT_ADMIN_ID |
int |
User ID of the bot admin, obtain it from my_id_bot | 123456789 |
IS_TESTNET |
bool |
Set to True for TON testnet or False for mainnet |
False |
MANIFEST_URL |
str |
URL of the bot's manifest file | https://raw.githubusercontent.com/nessshon/token-access-control-bot/main/tonconnect-manifest.json |
TONAPI_KEY |
str |
API key for TONAPI, obtain it from tonconsole.com | AE33E...3FYQ |
TONAPI_TONCONNECT_KEY |
str |
API key for TON Connect (optional), obtain it by contacting @subden | 587d4...5a71 |
SCHEDULER_CHECK_CHAT_MEMBERS_INTERVAL |
int |
Interval (minutes) for checking chat members (1-5 minutes is acceptable) | 1 |
SCHEDULER_UPDATE_TOKEN_HOLDERS_INTERVAL |
int |
Interval (minutes) for updating token holders (adjust value by Jetton holders or NFT elements. Every 1000 tokens or holders equals 1-2 seconds. For instance, for collections with 30k or fewer elements, set the value to 1) | 5 |
REDIS_HOST |
str |
Hostname or IP address of the Redis server (set redis if you don't have your own Redis server) |
redis |
REDIS_PORT |
int |
Port number of the Redis server (set 6379 if you don't have your own Redis server) |
6379 |
REDIS_DB |
int |
Redis database number (set 0 if you don't have your own Redis server) |
0 |
We welcome your contributions! If you have ideas for improvement or have identified a bug, please create an issue or submit a pull request.
TON - EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess
USDT (TRC-20) - TJjADKFT2i7jqNJAxkgeRm5o9uarcoLUeR
Supported by TON Society, Grants and Bounties program.
This repository is distributed under the MIT License.