Модуль изменения описания бота
This commit is contained in:
@@ -6,8 +6,8 @@ from aiogram.fsm.state import StatesGroup, State
|
|||||||
from aiogram.types import Message, CallbackQuery
|
from aiogram.types import Message, CallbackQuery
|
||||||
from aiogram.utils.i18n import gettext as _
|
from aiogram.utils.i18n import gettext as _
|
||||||
|
|
||||||
|
from bot.filters import IsSuperAdmin
|
||||||
from bot.core.bots import BotInfo
|
from bot.core.bots import BotInfo
|
||||||
from bot.filters import IsOwner
|
|
||||||
from bot.handlers.commands.settings.settings_cmd import settings_keyboard
|
from bot.handlers.commands.settings.settings_cmd import settings_keyboard
|
||||||
from bot.templates import msg
|
from bot.templates import msg
|
||||||
from bot.utils import format_retry_time, status_clear
|
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)
|
await bot.set_my_short_description(short_description=description)
|
||||||
|
|
||||||
# Сохраняем текущее значение в BotInfo
|
# Сохраняем текущее значение в BotInfo
|
||||||
BotInfo.short_description = description
|
BotInfo.widget = description
|
||||||
|
|
||||||
# Сбрасываем состояние FSM
|
# Сбрасываем состояние FSM
|
||||||
await state.clear()
|
await state.clear()
|
||||||
@@ -108,9 +108,9 @@ async def handle_set_bot_description(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.callback_query(F.data.lower() == CMD, IsOwner())
|
@router.callback_query(F.data.lower() == CMD, IsSuperAdmin())
|
||||||
@router.message(Command(*COMMANDS[CMD], prefix=BotInfo.prefix, ignore_case=True), IsOwner())
|
@router.message(Command(*COMMANDS[CMD], prefix=BotInfo.prefix, ignore_case=True), IsSuperAdmin())
|
||||||
async def settings_cmd(
|
async def set_description_cmd(
|
||||||
message: Message | CallbackQuery,
|
message: Message | CallbackQuery,
|
||||||
state: FSMContext,
|
state: FSMContext,
|
||||||
bot: Bot,
|
bot: Bot,
|
||||||
@@ -155,7 +155,7 @@ async def settings_cmd(
|
|||||||
await state.set_state(SetBotDescriptionForm.new_description)
|
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(
|
async def process_new_bot_description(
|
||||||
message: Message,
|
message: Message,
|
||||||
state: FSMContext,
|
state: FSMContext,
|
||||||
@@ -171,3 +171,4 @@ async def process_new_bot_description(
|
|||||||
return
|
return
|
||||||
|
|
||||||
await handle_set_bot_description(description, message, state, bot)
|
await handle_set_bot_description(description, message, state, bot)
|
||||||
|
BotInfo.description = description
|
||||||
|
|||||||
Reference in New Issue
Block a user