Skip to content

Commit 89580f7

Browse files
committed
Refactor: Professional codebase cleanup and improvements
- Add comprehensive docstrings and type hints to all modules - Improve code structure and organization - Remove unnecessary comments and verbose logging - Organize documentation into docs/ directory - Move test files to tests/ directory - Remove unused files and backup files - Add .editorconfig for consistent code style - Add GitHub Actions CI/CD workflow - Add CONTRIBUTING.md and CHANGELOG.md - Update README.md with clean structure - Improve error handling and thread safety - Enhance code quality and maintainability
1 parent c803c9c commit 89580f7

62 files changed

Lines changed: 2224 additions & 4730 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/model-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222

2323

2424

25+

.editorconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# EditorConfig helps maintain consistent coding styles
2+
# https://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.py]
13+
indent_style = space
14+
indent_size = 4
15+
max_line_length = 120
16+
17+
[*.{yml,yaml}]
18+
indent_style = space
19+
indent_size = 2
20+
21+
[*.md]
22+
trim_trailing_whitespace = false
23+
max_line_length = off
24+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
## Describe the Bug
11+
A clear and concise description of what the bug is.
12+
13+
## To Reproduce
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
## Expected Behavior
21+
A clear and concise description of what you expected to happen.
22+
23+
## Screenshots
24+
If applicable, add screenshots to help explain your problem.
25+
26+
## Environment
27+
- OS: [e.g. Ubuntu 22.04]
28+
- Python Version: [e.g. 3.10]
29+
- Bot Version: [e.g. 1.0.0]
30+
31+
## Logs
32+
```
33+
Paste relevant logs here
34+
```
35+
36+
## Additional Context
37+
Add any other context about the problem here.
38+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
## Feature Description
11+
A clear and concise description of the feature you'd like to see.
12+
13+
## Use Case
14+
Describe the use case or problem this feature would solve.
15+
16+
## Proposed Solution
17+
Describe how you envision this feature working.
18+
19+
## Alternatives Considered
20+
Describe any alternative solutions or features you've considered.
21+
22+
## Additional Context
23+
Add any other context, mockups, or examples about the feature request here.
24+

.github/workflows/python-app.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Python Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.8'
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -r requirements.txt
25+
pip install pytest pytest-asyncio pytest-cov
26+
27+
- name: Run tests
28+
run: |
29+
pytest tests/ -v --cov=src --cov-report=xml
30+
31+
- name: Upload coverage
32+
uses: codecov/codecov-action@v3
33+
with:
34+
file: ./coverage.xml
35+

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,14 @@ htmlcov/
4444

4545
# OS specific
4646
Thumbs.db
47+
.DS_Store
48+
49+
# Temporary files
50+
*.tmp
51+
*.bak
52+
*.swp
53+
*~
54+
55+
# Cursor IDE
56+
.cursor/
57+
.cursorrules

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [Unreleased]
6+
7+
### Added
8+
- Comprehensive button and keyboard verification
9+
- Thread-safe counter updates for bulk operations
10+
- FloodWaitError and SessionRevokedError handling
11+
- Automatic revoked session cleanup
12+
- Improved error handling and validation
13+
- Complete test coverage for all handlers
14+
15+
### Fixed
16+
- Race conditions in concurrent operations
17+
- Memory leaks in handlers dictionary
18+
- Duplicate error messages
19+
- Missing handlers for poll bulk operations
20+
- Thread safety issues in conversation state management
21+
22+
### Improved
23+
- Error messages consistency
24+
- Code organization and structure
25+
- Documentation and README
26+
- Test coverage and quality
27+
28+
## [1.0.0] - 2025-01-27
29+
30+
### Initial Release
31+
- Account management system
32+
- Message monitoring with keywords
33+
- Bulk operations (reaction, poll, join, block, send PV, comment)
34+
- Individual operations
35+
- Statistics and reporting
36+
- Complete test suite
37+

CONTRIBUTING.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Contributing to Telegram Panel
2+
3+
Thank you for your interest in contributing to Telegram Panel! This document provides guidelines and instructions for contributing.
4+
5+
## Getting Started
6+
7+
1. Fork the repository
8+
2. Clone your fork: `git clone https://github.com/your-username/Telegram-Panel.git`
9+
3. Create a branch: `git checkout -b feature/your-feature-name`
10+
4. Make your changes
11+
5. Test your changes
12+
6. Commit: `git commit -m "Add your feature"`
13+
7. Push: `git push origin feature/your-feature-name`
14+
8. Open a Pull Request
15+
16+
## Code Style
17+
18+
- Follow PEP 8 style guide
19+
- Use meaningful variable and function names
20+
- Add docstrings to functions and classes
21+
- Keep functions focused and small
22+
- Use type hints where helpful
23+
24+
## Testing
25+
26+
- Write tests for new features
27+
- Ensure all existing tests pass
28+
- Run tests before submitting: `pytest tests/`
29+
- Aim for high test coverage
30+
31+
## Commit Messages
32+
33+
- Use clear, descriptive commit messages
34+
- Start with a verb (Add, Fix, Update, Remove, etc.)
35+
- Keep the first line under 50 characters
36+
- Add more details in the body if needed
37+
38+
## Pull Request Process
39+
40+
1. Update README.md if needed
41+
2. Add tests for new functionality
42+
3. Ensure all tests pass
43+
4. Update documentation
44+
5. Request review from maintainers
45+
46+
## Reporting Issues
47+
48+
When reporting issues, please include:
49+
- Description of the problem
50+
- Steps to reproduce
51+
- Expected behavior
52+
- Actual behavior
53+
- Environment details (OS, Python version, etc.)
54+
- Relevant logs
55+
56+
## Questions?
57+
58+
Feel free to open an issue for questions or discussions.
59+

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
2-
3-
#it's not completed, it's not usable
4-
5-
61
# Telegram Management Bot Panel
72

83
A comprehensive Telegram bot management system for monitoring messages, managing multiple accounts, and performing bulk operations across Telegram groups and channels.

check_accounts_safety.sh

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)