## 1. Role System and Authorization
### 1.1 User Roles
- Administrator
- User
### 1.2 Administrator Functions
- Moderation of user accounts
- Confirmation of new registrations
- Deletion of accounts
- Management of statistics:
- Table of all accounts in the system with the following columns:
- Account ID
- Phone number
- Account owner (user)
- Number of created delayed messages
- Date of last activity
- Account deletion button
- Pagination:
- 50 records per page
- Page navigation
- Sorting by any column
- Data filtering:
- By user
- By date
- By number of messages
### 1.3 User Registration
- Registration fields:
- Login
- Password
- Telegram nickname
- Status: awaiting administrator confirmation
- Access to the panel only after confirmation
### 2. User Panel Functionality
2.1 Account Management
Button "Add Account"
Account table with the following elements:
Serial number
Account phone number
Button "Enable Mailing"
Button "Delete Account"
Checkbox to select account
Button "Enable Mailing for Selected"
### 3.3 Mailing Algorithm
1. Contact Collection:
- Retrieve all contacts
- Filter mutual contacts
- Sort by last online time:
- Online now
- Recently online
- Less than an hour ago
- Less than two hours ago
- And so on
2. Delayed Sending Mechanism:
- Grouping contacts by 5
- Quick creation of delayed messages:
- Minimum delay between requests to avoid API limits
- For the first group: delayed sending after 5 minutes from the current time
- For each subsequent group: +15 minutes to the sending time
- Example for 100 contacts:
- 20 groups of 5 contacts
- Creation of all delayed messages occurs sequentially with minimal delay
- Time to create all delayed messages: a few seconds
- Actual sending of messages will occur over 5 hours
- After creating all delayed messages:
- Immediate disconnection from the account
- Resource release
- Update statistics in the database
## 4. Technical Requirements
- Asynchronous execution of all operations
- Support for up to 50 parallel threads
- Storage of session and configuration files in a separate project folder
- Operation through proxy
- Error and exception handling
- Process logging
- Optimization of working with the Telegram API:
- Minimum delays between requests
- Efficient connection management
- Handling API limits
## 5. File Structure
- File proxy.txt with proxies
- Folder for storing sessions
- Folder for JSON account configurations
- Database for storing statistics:
- Accounts table
- Users table
- Table of sent message statistics