nessshon / token-access-control-bot

TON Token Control Bot manages access to your private Telegram chats using unique tokens for each participant.

Home Page:https://t.me/TONTokenAccessControlBot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🤖 TON Token Access Control Bot

TON Telegram Bot Python License Redis Docker

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.

Features

  • 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.

Usage

Preparation and installation
  1. Create a private group and/or channel.

  2. Create a bot via @BotFather and save the TOKEN (later referred to as BOT_TOKEN).

  3. Create an API key on tonconsole.com (later referred to as TONAPI_KEY).

  4. 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.
  5. Clone the repository:

    git clone https://github.com/nessshon/token-access-control-bot.git
  6. Navigate to the bot directory:

    cd token-access-control-bot
  7. Clone the environment variables file:

    cp .env.example .env
  8. Configure environment variables file:

    nano .env
  9. Install Docker and Docker Compose:

    sudo apt install docker.io && apt install docker-compose -y
  10. Run the bot in a Docker container:

    docker-compose up --build
  11. Start the bot with the command /start, choose the language, and connect wallet.

  12. Access the admin panel with the command /admin and add the token.

  13. 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.

  14. 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.

Environment Variables Reference

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 (5 minutes is acceptable) 5
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

Contribution

We welcome your contributions! If you have ideas for improvement or have identified a bug, please create an issue or submit a pull request.

Donations

TON - EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess

USDT (TRC-20) - TJjADKFT2i7jqNJAxkgeRm5o9uarcoLUeR

Support

Supported by TON Society, Grants and Bounties program.

License

This repository is distributed under the MIT License.

About

TON Token Control Bot manages access to your private Telegram chats using unique tokens for each participant.

https://t.me/TONTokenAccessControlBot

License:MIT License


Languages

Language:Python 99.8%Language:Dockerfile 0.2%