-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
42 lines (38 loc) · 2.51 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from aiogram.types import Message, CallbackQuery
from aiogram.filters import Command, CommandStart
from aiogram import Router, F
from keyboards import settings_btns
from filters.is_admin import IsAdmin
from database.db_action import db_get_all_data
router = Router()
@router.callback_query(F.data == 'settings')
async def process_start(callback: CallbackQuery):
#await callback.message.delete()
all_data = await db_get_all_data()
telegram_channels = ' '.join([x[0] for x in all_data['telegram_groups']] or 'Нет добавленных каналов')
telegram_accounts = len(all_data['telegram_accounts'] or 'Нет добавленных аккаунтов')
gpt_accounts = len(all_data['gpt_accounts']) or 'Нет добавленных аккаунтов'
monitor = ''.join(all_data['telegram_monitor_account'][0] or 'Не установлен')
print(all_data)
await callback.message.answer(text=f'<b>Монитор:</b> {monitor}\n'
f'<b>Telegram аккаунты:</b> {telegram_accounts}\n'
f'<b>Каналы:</b> {telegram_channels}\n'
f'<b>GPT Аккаунты:</b> {gpt_accounts}\n\n'
'<b>Информация:</b> /help_settings',
reply_markup=settings_btns(),
parse_mode='HTML')
@router.callback_query(F.data == 'back_to_settings')
async def back_to_settings(callback: CallbackQuery):
#await callback.message.delete()
all_data = await db_get_all_data()
telegram_channels = ' '.join([x[0] for x in all_data['telegram_groups']])
telegram_accounts = len(all_data['telegram_accounts']) or 'Нет добавленных аккаунтов'
gpt_accounts = len(all_data['gpt_accounts']) or 'Нет добавленных аккаунтов'
monitor = ''.join(all_data['telegram_monitor_account'][0]) or 'Не установлен'
await callback.message.answer(text=f'<b>Монитор:</b> {monitor}\n'
f'<b>Telegram аккаунты:</b> {telegram_accounts}\n'
f'<b>Каналы:</b> {telegram_channels}\n'
f'<b>GPT Аккаунты:</b> {gpt_accounts}\n\n'
'<b>Информация:</b> /help_settings',
reply_markup=settings_btns(),
parse_mode='HTML')