Модуль установки имени бота
This commit is contained in:
@@ -6,8 +6,8 @@ from aiogram.fsm.state import StatesGroup, State
|
||||
from aiogram.types import Message, CallbackQuery
|
||||
from aiogram.utils.i18n import gettext as _
|
||||
|
||||
from bot.filters import IsSuperAdmin
|
||||
from bot.core.bots import BotInfo
|
||||
from bot.filters import IsOwner
|
||||
from bot.handlers.commands.settings.settings_cmd import settings_keyboard
|
||||
from bot.templates import msg
|
||||
from configs import COMMANDS
|
||||
@@ -98,9 +98,9 @@ async def handle_set_name(
|
||||
)
|
||||
|
||||
|
||||
@router.callback_query(F.data.lower() == CMD, IsOwner())
|
||||
@router.message(Command(*COMMANDS[CMD], prefix=BotInfo.prefix, ignore_case=True), IsOwner())
|
||||
async def settings_cmd(
|
||||
@router.callback_query(F.data.lower() == CMD, IsSuperAdmin())
|
||||
@router.message(Command(*COMMANDS[CMD], prefix=BotInfo.prefix, ignore_case=True), IsSuperAdmin())
|
||||
async def set_name_cmd(
|
||||
message: Message | CallbackQuery,
|
||||
state: FSMContext,
|
||||
bot: Bot,
|
||||
@@ -143,7 +143,7 @@ async def settings_cmd(
|
||||
await state.set_state(SetNameForm.new_name)
|
||||
|
||||
|
||||
@router.message(SetNameForm.new_name, IsOwner())
|
||||
@router.message(SetNameForm.new_name, IsSuperAdmin())
|
||||
async def process_new_name(message: Message, state: FSMContext, bot: Bot):
|
||||
"""
|
||||
Обработка ввода нового имени через FSM
|
||||
@@ -155,3 +155,4 @@ async def process_new_name(message: Message, state: FSMContext, bot: Bot):
|
||||
return
|
||||
|
||||
await handle_set_name(new_name, message, state, bot)
|
||||
BotInfo.first_name = new_name
|
||||
|
||||
Reference in New Issue
Block a user