Admin Bot — is a simple and user-friendly Telegram bot designed for efficient management of content and users within a Telegram channel.
The project is built using Python 3.12.2, leveraging aiogram
for seamless interaction with the Telegram API,
asyncpg
for efficient asynchronous database operations, Babel
for easy localization,
and SQLAlchemy
for robust database modeling with PostgreSQL
.
This combination ensures high performance, scalability, and ease of use for administrators and content managers.
- Key Features 🎯
- Installation and Setup ⚙️
- Project Structure 🗂️
- Makefile Commands 🛠️
- Adding New Languages 🌐
- Future Plans 🚀
- Contributing 💡
- License 🏷️
- Author 👤
- Post Management: View, create, edit, and delete posts.
- Administrators can maintain full control over content, ensuring that all posts meet the desired standards before publication
- Publish to Channel: Publish posts directly to a Telegram channel.
- Content managers can quickly share updates or announcements with their audience, streamlining communication.
- User Roles: Assign and manage roles like administrator or content manager.
- Manage permissions directly through the bot, ensuring that access to functions is given only to authorized users.
- Localization: Supports English and Russian (en/ru).
- Ready to expand to additional languages, offering flexibility for different user bases and international audiences.
Requirements:
- Python 3.12.2
- PostgreSQL 16.3
Install dependencies from requirements.txt
git clone https://github.com/dev-lymar/channel-admin-bot.git
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
API_TOKEN=your_bot_token
ADMIN_ID=administrator_ID (For initial setup)
DB_URL=postgresql+asyncpg://user:password@localhost:5432/database_name
CHAT_ID=channel_ID_for_publications
make run
.
├── main.py # Entry point of the application
├── config/ # Configuration files
│ ├── .env.example # Example environment variables file
│ └── bot_config.py # Bot configuration and settings
├── db/ # Database management
│ ├── db_handler/ # Handlers for posts and user roles
│ └── models/ # Database models
├── handlers/ # Command and function handlers for the bot
│ ├── admin_panel/ # Logic for the admin panel
│ └── start/ # Start command
├── locales/ # Localization files
│ ├── en/ # English translations
│ └── ru/ # Russian translations
├── keyboards/ # Telegram keyboards for user interaction
├── states/ # User state management
├── requirements.txt # Project dependencies
├── README.md # Project documentation
└── LICENSE # License for project usage
make run
: Runs the bot and compiles translation files.po
into.mo
.make lint
: Checks the code for style compliance usingruff
andflake8
.
- If there are changes in the text, update the message template (
if not, proceed to step 3
):
pybabel extract -k _:1,1t -k _:1,2 -k __ --input-dirs=. -o locales/messages.pot
- Update existing locales:
pybabel update -d locales -D messages -i locales/messages.pot
- Create a new locale (e.g.,
uk
for Ukrainian):
pybabel init -i locales/messages.pot -d locales -D messages -l uk
- Compile translations automatically using
make run
or manually:
pybabel compile -d locales -D messages
- Docker Integration: Implement a Docker file for easier project deployment.
- Documentation: Provide detailed documentation for all modules, including usage examples and possible scenarios.
- Role Expansion: Add more roles and access management capabilities.
We welcome contributions from the community! If you want to add new features or fix bugs, please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature/feature-name
- Make your changes and commit them:
git commit -m 'Added a new feature'
- Push your changes:
git push origin feature/feature-name
- Create a pull request.
Before creating a pull request, make sure your code passes all ruff and flake8 checks.
This project is licensed under the MIT License. See the LICENSE file for more details.
This project was developed by dev-lymar. If you enjoyed the project, please give a star ⭐️ on the repository.
If you have any questions or suggestions, feel free to reach out: