Модуль изменения описания бота
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 bot.utils import format_retry_time, status_clear
|
||||
@@ -60,7 +60,7 @@ async def handle_set_bot_description(
|
||||
await bot.set_my_short_description(short_description=description)
|
||||
|
||||
# Сохраняем текущее значение в BotInfo
|
||||
BotInfo.short_description = description
|
||||
BotInfo.widget = description
|
||||
|
||||
# Сбрасываем состояние FSM
|
||||
await state.clear()
|
||||
@@ -108,9 +108,9 @@ async def handle_set_bot_description(
|
||||
)
|
||||
|
||||
|
||||
@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_description_cmd(
|
||||
message: Message | CallbackQuery,
|
||||
state: FSMContext,
|
||||
bot: Bot,
|
||||
@@ -155,7 +155,7 @@ async def settings_cmd(
|
||||
await state.set_state(SetBotDescriptionForm.new_description)
|
||||
|
||||
|
||||
@router.message(SetBotDescriptionForm.new_description, IsOwner())
|
||||
@router.message(SetBotDescriptionForm.new_description, IsSuperAdmin())
|
||||
async def process_new_bot_description(
|
||||
message: Message,
|
||||
state: FSMContext,
|
||||
@@ -171,3 +171,4 @@ async def process_new_bot_description(
|
||||
return
|
||||
|
||||
await handle_set_bot_description(description, message, state, bot)
|
||||
BotInfo.description = description
|
||||
|
||||
Reference in New Issue
Block a user