Telegram Bot with an Admin Panel on Next.js
Core Functionality of the Project
The project is aimed at automating interactions in a Telegram chat, including sending messages with buttons, greeting new members, and blocking users who use prohibited words.
Bot Functionality in Telegram Chat
- Response to Key Words:
- When a chat participant types a key word, the bot automatically sends a message with the corresponding text and interactive buttons.
- Greeting New Participants:
- When a new user joins the chat, the bot sends a greeting message with buttons, providing useful information or links for interaction.
- Blocking for Prohibited Words:
- If a chat participant uses a prohibited word, the bot performs the following actions:
- Deletes the message containing the prohibited word.
- Blocks the user who violated the chat rules.
Admin Panel for Managing the Bot
An admin panel has been developed based on an internal Next.js API to manage the bot's settings and behavior. The admin panel provides the following features:
-
Editing Key Words:
- Ability to add and modify key words that the bot should respond to.
-
Managing Prohibited Words:
- Adding and removing prohibited words for automatic moderation.
-
Button Configuration:
- Adding new buttons and modifying their arrangement in the bot's messages.
-
User Exceptions:
- Adding usernames of participants who will not be blocked and to whom the bot will not send messages based on key words.
Admin Panel Authentication
- Authentication via MetaMask:
- MetaMask is used for logging into the admin panel with a specific wallet authorization, ensuring security and access only for trusted users.
Database Management
- Prisma and SQLite:
- All data edited via the admin panel is saved in an SQLite database using Prisma, ensuring convenient and type-safe interaction with the data within Next.js.
Additional Functionality: Userbot
The project also includes a userbot, designed for performing special tasks:
- Reactions to Posts in a Channel:
- A userbot, authorized via a client, automatically adds reactions to all posts in a specific Telegram channel on behalf of the user. This can be useful for maintaining activity and interacting with the channel's content.
Technical Details
Technologies
- Next.js (latest version): A framework for server-side and client-side rendering with high performance.
- TypeScript: TypeScript is used to write secure and type-safe code.
- Prisma: An ORM for interacting with the database, making SQLite usage simple and efficient.
- Telegram API: For automating chat operations and interacting with participants.
- MetaMask Authentication: Ensures secure access to the admin panel with wallet verification.
Project Benefits
-
Convenience for Administrators:
- Full control over key words, prohibited words, and interaction settings through an intuitive admin panel.
-
Chat Automation:
- The bot performs routine tasks, such as greeting participants, responding to requests, and blocking violators, significantly reducing the moderators' workload.
-
Customization Flexibility:
- The ability to change buttons and exceptions for users allows for quick adaptation of the bot's functionality to the current needs of the chat.
-
Security:
- Access to the admin panel is only available through MetaMask, providing a high level of security and protection against unauthorized access.
Final Outcome
The project is a powerful tool for managing and moderating a Telegram chat, offering administrators flexibility and convenience while providing users with a comfortable interaction through automatically generated messages and reactions. The use of modern technologies makes the solution efficient, reliable, and secure, meeting both technical and business requirements.
Internal project