From e3543c24337cd9a61bb327747466325d04d99a39 Mon Sep 17 00:00:00 2001 From: Whyverum Date: Mon, 23 Dec 2024 22:01:10 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B0=20/r?= =?UTF-8?q?andnum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BotCode/keyboards/inline_kb/randnum_kb.py | 6 +++--- BotCode/routers/callback_handlers/randnum_kb_cb.py | 8 +++++++- BotCode/routers/commands/user_cmd/randnum_cmd.py | 8 +++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/BotCode/keyboards/inline_kb/randnum_kb.py b/BotCode/keyboards/inline_kb/randnum_kb.py index fc21754..0fff06e 100644 --- a/BotCode/keyboards/inline_kb/randnum_kb.py +++ b/BotCode/keyboards/inline_kb/randnum_kb.py @@ -1,8 +1,8 @@ -# BotCode/keyboards/start_kb.py -# Создания клавиатуры на команду: /start +# BotCode/keyboards/inline_kb/randnum_kb.py +# Создания инлайн-клавиатуры на команду: /randnum from aiogram import Router -from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton +from aiogram.types import InlineKeyboardMarkup from aiogram.utils.keyboard import InlineKeyboardBuilder # Создание роутера и настройка экспорта diff --git a/BotCode/routers/callback_handlers/randnum_kb_cb.py b/BotCode/routers/callback_handlers/randnum_kb_cb.py index cad88b2..f6e5ec3 100644 --- a/BotCode/routers/callback_handlers/randnum_kb_cb.py +++ b/BotCode/routers/callback_handlers/randnum_kb_cb.py @@ -1,11 +1,17 @@ -from random import randint +# BotCode/routers/callback_handlers/randnum_kb_cb.py +# Обработчик запросов в команде /randnum +from random import randint from aiogram import Router, F from aiogram.types import CallbackQuery from keyboards.inline_kb.randnum_kb import ButtonInl, get_randnum_kb +# Создание роутера и настройка экспорта модулей +__all__ = ("router",) router = Router(name="randnum_kb_cb_router") + +# Тестирование редактирования сообщения @router.callback_query(F.data == ButtonInl.mark_cbd) async def random_site_cb(callback_query: CallbackQuery): await callback_query.answer() diff --git a/BotCode/routers/commands/user_cmd/randnum_cmd.py b/BotCode/routers/commands/user_cmd/randnum_cmd.py index ec10b68..634c099 100644 --- a/BotCode/routers/commands/user_cmd/randnum_cmd.py +++ b/BotCode/routers/commands/user_cmd/randnum_cmd.py @@ -5,18 +5,20 @@ from aiogram import Router, types, F from aiogram.filters import Command from BotLibrary import * from keyboards.inline_kb.randnum_kb import get_randnum_kb +from routers.msg_default import msg_default -# Создание роутера и экспорта модулей +# Создание роутера, переменных и экспорта модулей __all__ = ("router", "cmd_randnum", "log_type",) router = Router(name="randnum_router") log_type = "Randnum" +description = "Описание" # Список ключевых слов для команды keywords = ["кфтвтгь", "randnum",] # Хэндлер на команду /randnum -@router.message(Command(*keywords, prefix=BotEdit.prefixs, ignore_case=True)) +@router.message(Command(*keywords, prefix=BotVariables.prefixs, ignore_case=True)) @router.message(F.text.lower().in_(keywords)) async def cmd_randnum(message: types.Message): text = "Работа с рандомом оценок!" @@ -27,4 +29,4 @@ async def cmd_randnum(message: types.Message): # Активация логгера await cmd_logginger(message, log_type, text) - return text + await msg_default(message)