mirror of
https://github.com/djimboy/djimbo_template_aio3.git
synced 2026-07-25 01:34:30 +00:00
Update
This commit is contained in:
@@ -7,14 +7,14 @@ 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, AS
|
||||
from tgbot.utils.misc.bot_models import FSM, RS
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
# Кнопка - Admin Inline
|
||||
@router.message(Text(text="Admin Inline"))
|
||||
async def admin_button_inline(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def admin_button_inline(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer("Click Button - Admin Inline", reply_markup=admin_inl)
|
||||
@@ -22,7 +22,7 @@ async def admin_button_inline(message: Message, bot: Bot, state: FSM, rSession:
|
||||
|
||||
# Кнопка - Admin Reply
|
||||
@router.message(Text(text="Admin Reply"))
|
||||
async def admin_button_reply(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def admin_button_reply(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer("Click Button - Admin Reply", reply_markup=admin_rep)
|
||||
@@ -30,13 +30,13 @@ async def admin_button_reply(message: Message, bot: Bot, state: FSM, rSession: A
|
||||
|
||||
# Колбэк - Admin X
|
||||
@router.callback_query(Text(text="admin_inline_x"))
|
||||
async def admin_callback_inline_x(call: CallbackQuery, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def admin_callback_inline_x(call: CallbackQuery, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await call.answer(f"Click Admin X")
|
||||
|
||||
|
||||
# Колбэк - Admin
|
||||
@router.callback_query(Text(startswith="admin_inline:"))
|
||||
async def admin_callback_inline(call: CallbackQuery, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def admin_callback_inline(call: CallbackQuery, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
get_data = call.data.split(":")[1]
|
||||
|
||||
await call.answer(f"Click Admin - {get_data}", True)
|
||||
@@ -44,7 +44,7 @@ async def admin_callback_inline(call: CallbackQuery, bot: Bot, state: FSM, rSess
|
||||
|
||||
# Получение Базы Данных
|
||||
@router.message(Command(commands=['db', 'database']))
|
||||
async def admin_database(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def admin_database(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer_document(FSInputFile(PATH_DATABASE),
|
||||
@@ -54,7 +54,7 @@ async def admin_database(message: Message, bot: Bot, state: FSM, rSession: AS, m
|
||||
|
||||
# Получение логов
|
||||
@router.message(Command(commands=['log', 'logs']))
|
||||
async def admin_log(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def admin_log(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer_document(FSInputFile(PATH_LOGS),
|
||||
@@ -64,7 +64,7 @@ async def admin_log(message: Message, bot: Bot, state: FSM, rSession: AS, my_use
|
||||
|
||||
# Очистить логи
|
||||
@router.message(Command(commands=['clear_log', 'clear_logs', 'log_clear', 'logs_clear']))
|
||||
async def admin_logs_clear(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def admin_logs_clear(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
with open(PATH_LOGS, "w") as file:
|
||||
|
||||
@@ -4,26 +4,26 @@ from aiogram.filters import Text
|
||||
from aiogram.types import CallbackQuery, Message
|
||||
|
||||
from tgbot.keyboards.reply_main import menu_frep
|
||||
from tgbot.utils.misc.bot_models import FSM, AS
|
||||
from tgbot.utils.misc.bot_models import FSM, RS
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
# Колбэк с удалением сообщения
|
||||
@router.callback_query(Text(text="close_this"))
|
||||
async def main_callback_close(call: CallbackQuery, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def main_callback_close(call: CallbackQuery, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await call.message.delete()
|
||||
|
||||
|
||||
# Колбэк с обработкой кнопки
|
||||
@router.callback_query(Text(text="..."))
|
||||
async def main_callback_answer(call: CallbackQuery, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def main_callback_answer(call: CallbackQuery, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await call.answer(cache_time=30)
|
||||
|
||||
|
||||
# Колбэк с обработкой удаления сообщений потерявших стейт
|
||||
@router.callback_query()
|
||||
async def main_callback_missed(call: CallbackQuery, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def main_callback_missed(call: CallbackQuery, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
try:
|
||||
await call.message.delete()
|
||||
except:
|
||||
@@ -38,6 +38,6 @@ async def main_callback_missed(call: CallbackQuery, bot: Bot, state: FSM, rSessi
|
||||
|
||||
# Обработка всех неизвестных команд
|
||||
@router.message()
|
||||
async def main_message_missed(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def main_message_missed(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await message.answer("♦ Неизвестная команда.\n"
|
||||
"♦ Введите /start")
|
||||
|
||||
@@ -5,7 +5,7 @@ from aiogram.types import Message
|
||||
|
||||
from tgbot.keyboards.reply_main import menu_frep
|
||||
from tgbot.utils.const_functions import ded
|
||||
from tgbot.utils.misc.bot_models import FSM, AS
|
||||
from tgbot.utils.misc.bot_models import FSM, RS
|
||||
|
||||
router = Router()
|
||||
|
||||
@@ -13,7 +13,7 @@ router = Router()
|
||||
# Открытие главного меню
|
||||
@router.message(Text(text=['🔙 Главное меню']))
|
||||
@router.message(Command(commands=['start']))
|
||||
async def main_start(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def main_start(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer(
|
||||
|
||||
@@ -6,14 +6,14 @@ from aiogram.types import Message, CallbackQuery
|
||||
from tgbot.keyboards.inline_main import menu_finl
|
||||
from tgbot.keyboards.inline_misc import user_inl
|
||||
from tgbot.keyboards.reply_misc import user_rep
|
||||
from tgbot.utils.misc.bot_models import FSM, AS
|
||||
from tgbot.utils.misc.bot_models import FSM, RS
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
# Кнопка - User Inline
|
||||
@router.message(Text(text="User Inline"))
|
||||
async def user_button_inline(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def user_button_inline(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer("Click Button - User Inline", reply_markup=user_inl)
|
||||
@@ -21,7 +21,7 @@ async def user_button_inline(message: Message, bot: Bot, state: FSM, rSession: A
|
||||
|
||||
# Кнопка - User Reply
|
||||
@router.message(Text(text="User Reply"))
|
||||
async def user_button_reply(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def user_button_reply(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer("Click Button - User Reply", reply_markup=user_rep)
|
||||
@@ -29,7 +29,7 @@ async def user_button_reply(message: Message, bot: Bot, state: FSM, rSession: AS
|
||||
|
||||
# Команда - /inline
|
||||
@router.message(Command(commands="inline"))
|
||||
async def user_command_inline(message: Message, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def user_command_inline(message: Message, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await state.clear()
|
||||
|
||||
await message.answer("Click command - /inline", reply_markup=menu_finl(message.from_user.id))
|
||||
@@ -37,13 +37,13 @@ async def user_command_inline(message: Message, bot: Bot, state: FSM, rSession:
|
||||
|
||||
# Колбэк - User X
|
||||
@router.callback_query(Text(text="user_inline_x"))
|
||||
async def user_callback_inline_x(call: CallbackQuery, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def user_callback_inline_x(call: CallbackQuery, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
await call.answer(f"Click User X")
|
||||
|
||||
|
||||
# Колбэк - User
|
||||
@router.callback_query(Text(startswith="user_inline:"))
|
||||
async def user_callback_inline(call: CallbackQuery, bot: Bot, state: FSM, rSession: AS, my_user):
|
||||
async def user_callback_inline(call: CallbackQuery, bot: Bot, state: FSM, rSession: RS, my_user):
|
||||
get_data = call.data.split(":")[1]
|
||||
|
||||
await call.answer(f"Click User - {get_data}", True)
|
||||
|
||||
@@ -4,4 +4,4 @@ from aiogram.fsm.context import FSMContext
|
||||
from tgbot.services.api_session import RequestSession
|
||||
|
||||
FSM = FSMContext
|
||||
AS = RequestSession
|
||||
RS = RequestSession
|
||||
|
||||
Reference in New Issue
Block a user