Skip to content

Commit 80d4ca5

Browse files
committed
ADD: assets, markdown directory
RELEASE: 1.1.0
1 parent 1205622 commit 80d4ca5

File tree

11 files changed

+105
-18
lines changed

11 files changed

+105
-18
lines changed

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
1-
# AdvancedUserTelegramBot
1+
# PyConsoleMenu
2+
![Language](https://img.shields.io/badge/Language-Python3.10+-blue.svg?style=flat)
3+
[![BUILD-STATUS](https://github.com/BaggerFast/AdvancedUserTelegramBot/workflows/CI/badge.svg)](https://github.com/BaggerFast/AdvancedUserTelegramBot/actions)
4+
5+
This is a telegram bot that creates a user bot for each user.
6+
The user bot allows you to use custom animations in any chat.
7+
Animations are divided into paid and free
8+
9+
10+
--------
11+
12+
## Example:
13+
[<img src="assets/preview.gif" width="639" height="235.5" alt="preview"/>](assets/preview.gif)
14+
15+
## Tech Stack 💻
16+
17+
- **Languages:**
18+
- Python 3.10
19+
- **Telegram:**
20+
- [Aiogram](https://docs.aiogram.dev/en/latest/) - for main bot
21+
- [Pyrogram](https://docs.pyrogram.org/) - for user bot
22+
- **Database:**
23+
- Sqlite3
24+
- [Sqlalchemy](https://docs.sqlalchemy.org/en/14/)
25+
- **Payment:**
26+
- [Yookassa](https://yookassa.ru/developers)
27+
- **Debug:**
28+
- Pylint
29+
- Loguru
30+
--------
31+
32+
## Installation 💾
33+
34+
[QUICK START](markdown/quick_start.md?)
35+
36+
--------
37+
38+
## Code Guide👋
39+
40+
[GUIDE](markdown/examples.md?)
41+
42+
--------

assets/preview.gif

1.52 MB
Loading

markdown/examples.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Code Guide
2+
3+
### To understand the architecture of the application, watch this [VIDEO](https://www.youtube.com/watch?v=W-0YoEYBSwU&t=23s)
4+
5+
## [Main Bot](../telegram_bot/main.py)
6+
1. [Setup config.py](../telegram_bot/utils/config.py):
7+
- PRICE - price for vip access
8+
- HELPER_URL - telegram username (@username) for help btn
9+
- BOT_URL - this bot username (@bot) for advert in free commands
10+
- VIP_HELP_URL - site url for view vip help commands
11+
- VIP_HELP_URL - site url for view free help commands
12+
13+
2. Add user commands [HERE](../telegram_bot/handlers/user/main.py)
14+
3. Add admin commands [HERE](../telegram_bot/handlers/admin/main.py)
15+
16+
4. If you want to change the payment system, edit this [FILE](../telegram_bot/handlers/user/buy_vip.py)
17+
--------
18+
19+
## [User Bot](../user_bot/main.py)
20+
1. [Setup config.py](../user_bot/utils/config.py):
21+
- PREFIX - sign for commands (.hello)
22+
23+
2. Add Free commands [HERE](../user_bot/handlers/common/main.py)
24+
3. Add Vip commands [HERE](../user_bot/handlers/vip/main.py)
25+
26+
--------
27+
28+
### [BACK](../README.md)

markdown/quick_start.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# QUICK_START
2+
3+
1. Clone project
4+
2. Create a virtual venv
5+
3. Install requirements:
6+
```
7+
pip install --upgrade pip
8+
pip install -r requirements.txt
9+
```
10+
4. [Setup environment variables](https://stackoverflow.com/questions/42708389/how-to-set-environment-variables-in-pycharm):
11+
- [TOKEN](https://telegram.me/BotFather)
12+
- [ADMIN_ID](https://telegram.me/myidbot)
13+
- [API_HASH](https://my.telegram.org/)
14+
- [API_ID](https://my.telegram.org/)
15+
- [SHOP_ID](https://yookassa.ru/)
16+
- [SHOP_TOKEN](https://yookassa.ru/)
17+
18+
19+
5. Run run.py
20+
6. When you first start your bot, use the /admin command (if you set ADMIN_ID)
21+
--------
22+
23+
### [BACK](../README.md)

requirements.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
# Telegram
2-
Pyrogram~=2.0.41
3-
aiogram~=2.22.1
4-
2+
Pyrogram
3+
aiogram
54

65
# Database
7-
SQLAlchemy~=1.4.40
6+
SQLAlchemy
87

98
# Debug
109
pylint_runner
11-
loguru~=0.6.0
10+
loguru
1211

1312
# Other
14-
asyncio~=3.4.3
13+
asyncio
1514
tgcrypto
1615

17-
18-
yookassa~=2.3.2
16+
#Payment
17+
yookassa

run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
def main():
99
log_path = PathManager.get('logs/debug.log')
10-
logger.add(log_path, format="{time} {level} {message}",
11-
level="DEBUG", rotation="10:00", compression="zip")
10+
logger.add(log_path, format="{time} {level} {message}", level="DEBUG", rotation="10:00", compression="zip")
1211
start_telegram_bot()
1312

1413

run_user_bot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/python
21
from user_bot import start_user_bot
32

43
if __name__ == '__main__':

telegram_bot/handlers/admin/main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ async def __admin_insert_tg_id(msg: Message, state: FSMContext):
3131
bot: Bot = msg.bot
3232
user_id = msg.from_user.id
3333
admin_id = int(msg.text)
34-
# todo remove Exception
3534
try:
3635
set_admin(admin_id)
3736
set_vip(admin_id)
@@ -46,6 +45,7 @@ async def __admin_insert_tg_id(msg: Message, state: FSMContext):
4645
await bot.send_message(user_id, 'Админ панель', reply_markup=get_admin_keyboard(user_id))
4746
await state.set_state(AdminStates.ADMIN)
4847

48+
4949
# endregion
5050

5151
# region Advert
@@ -72,11 +72,11 @@ async def __do_advertising(query: Message, state: FSMContext):
7272
await bot.send_message(user_id, f"Рассылка выполнена - у {count} пользователей ✅")
7373
await bot.send_message(user_id, 'Админ панель', reply_markup=get_admin_keyboard(user_id))
7474

75+
7576
# endregion
7677

7778

7879
async def __analytic(query: CallbackQuery, state: FSMContext) -> None:
79-
8080
users_count = get_user_count()
8181
user_session_count = get_sessions_count()
8282
vip_session_enable_count = get_sessions_enable_count(True)
@@ -95,7 +95,6 @@ async def __analytic(query: CallbackQuery, state: FSMContext) -> None:
9595

9696

9797
def register_admin_handlers(dp: Dispatcher) -> None:
98-
9998
# region Msg handlers
10099

101100
dp.register_message_handler(__admin_insert_tg_id, IsAdmin(), content_types=['text'],

telegram_bot/handlers/user/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from aiogram import Dispatcher, Bot
2-
from aiogram.types import Message, CallbackQuery
2+
from aiogram.types import Message
33

44
from telegram_bot.handlers.user.buy_vip import _register_vip_handlers
55
from telegram_bot.handlers.user.user_bot import _register_user_bot_handlers

telegram_bot/handlers/user/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _buy_vip_text() -> str:
2323
b("😯 Чем VIP отличается от бесплатного бота?\n"),
2424
i("・ Отсутствие рекламного текста после анимаций"),
2525
i("・ Доступ к VIP командам\n"),
26-
b(f"Для покупки нажмите на кнопку Оплатить."),
26+
b("Для покупки нажмите на кнопку Оплатить."),
2727
b("После оплаты не забудьте ее проверить!")
2828
)
2929
return "\n".join(data)

0 commit comments

Comments
 (0)