Template
mirror of
https://github.com/djimboy/djimbo_template_aio3.git
synced 2026-08-28 07:57:44 +00:00
Update
This commit is contained in:
@@ -2,19 +2,18 @@
|
||||
from aiogram import Router, Bot
|
||||
from aiogram.types import FSInputFile, Message
|
||||
|
||||
from tgbot.data.config import PATH_DATABASE, PATH_LOGS
|
||||
from tgbot.data.config import PATH_DATABASE, PATH_LOGS
|
||||
from tgbot.keyboards.inline_misc import admin_inl
|
||||
from tgbot.keyboards.reply_misc import admin_rep
|
||||
from tgbot.utils.const_functions import get_date
|
||||
from tgbot.utils.misc.bot_models import FSM, RS
|
||||
from tgbot.utils.misc.bot_models import FSM, AS
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
# Кнопка - Admin Inline
|
||||
@router.message(text="Admin Inline")
|
||||
async def admin_button_inline(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
async def admin_button_inline(message: Message, bot: Bot, state: FSM, aSession: AS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer("Click Button - Admin Inline", reply_markup=admin_inl)
|
||||
@@ -22,7 +21,7 @@ async def admin_button_inline(message: Message, bot: Bot, state: FSM, rSession:
|
||||
|
||||
# Кнопка - Admin Reply
|
||||
@router.message(text="Admin Reply")
|
||||
async def admin_button_reply(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
async def admin_button_reply(message: Message, bot: Bot, state: FSM, aSession: AS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer("Click Button - Admin Reply", reply_markup=admin_rep)
|
||||
@@ -30,7 +29,7 @@ async def admin_button_reply(message: Message, bot: Bot, state: FSM, rSession: R
|
||||
|
||||
# Получение Базы Данных
|
||||
@router.message(commands=['db', 'database'])
|
||||
async def admin_database(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
async def admin_database(message: Message, bot: Bot, state: FSM, aSession: AS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer_document(FSInputFile(PATH_DATABASE),
|
||||
@@ -40,7 +39,19 @@ async def admin_database(message: Message, bot: Bot, state: FSM, rSession: RS, m
|
||||
|
||||
# Получение логов
|
||||
@router.message(commands=['log', 'logs'])
|
||||
async def admin_log(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
async def admin_log(message: Message, bot: Bot, state: FSM, aSession: AS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer_document(FSInputFile(PATH_LOGS), caption=f"<code>🕰 {get_date()}</code>")
|
||||
|
||||
|
||||
# Очистить логи
|
||||
@router.message(text_contains=['log', '_', 'clean'])
|
||||
@router.message(text_contains=['log', '_', 'clear'])
|
||||
async def admin_log_clear(message: Message, bot: Bot, state: FSM, aSession: AS, my_user):
|
||||
await state.clear()
|
||||
|
||||
with open(PATH_LOGS, "w") as file:
|
||||
file.write(f"{get_date()} | LOGS WAS CLEAR")
|
||||
|
||||
await message.answer("<b>🖨 Логи были успешно очищены</b>")
|
||||
|
||||
Reference in New Issue
Block a user