fix
This commit is contained in:
+2
-21
@@ -974,14 +974,7 @@ class BotInterface:
|
|||||||
if balance <= 0:
|
if balance <= 0:
|
||||||
await callback.answer("❌ Недостаточно баланса", show_alert=True)
|
await callback.answer("❌ Недостаточно баланса", show_alert=True)
|
||||||
return
|
return
|
||||||
all_tasks = await interface.task_manager.get_all_tasks()
|
all_tasks = await interface.task_manager.get_all_tasks()
|
||||||
active_count = sum(
|
|
||||||
1 for p in all_tasks.values()
|
|
||||||
if p.user_id == uid and not p.completed and not p.stopped
|
|
||||||
)
|
|
||||||
if active_count >= 3:
|
|
||||||
await callback.answer("❌ Максимум 3 активные задачи", show_alert=True)
|
|
||||||
return
|
|
||||||
builder = InlineKeyboardBuilder()
|
builder = InlineKeyboardBuilder()
|
||||||
builder.row(InlineKeyboardButton(text="📺 Twitch мониторинг", callback_data="task_type_twitch"))
|
builder.row(InlineKeyboardButton(text="📺 Twitch мониторинг", callback_data="task_type_twitch"))
|
||||||
builder.row(InlineKeyboardButton(text="🔗 Посещение по ссылке", callback_data="task_type_url"))
|
builder.row(InlineKeyboardButton(text="🔗 Посещение по ссылке", callback_data="task_type_url"))
|
||||||
@@ -2728,19 +2721,7 @@ class BotInterface:
|
|||||||
if not re.match(r'^[a-zA-Z0-9_]+$', text):
|
if not re.match(r'^[a-zA-Z0-9_]+$', text):
|
||||||
await message.answer("❌ Неверное название канала (только буквы, цифры, _). Попробуйте ещё раз:")
|
await message.answer("❌ Неверное название канала (только буквы, цифры, _). Попробуйте ещё раз:")
|
||||||
return
|
return
|
||||||
channel = text.lower()
|
channel = text.lower()
|
||||||
# Проверка на дубликат
|
|
||||||
all_tasks = await self.task_manager.get_all_tasks()
|
|
||||||
duplicate = any(
|
|
||||||
p.user_id == user_id and p.channel == channel and not p.completed and not p.stopped
|
|
||||||
for p in all_tasks.values()
|
|
||||||
)
|
|
||||||
if duplicate:
|
|
||||||
await self._send_temp(
|
|
||||||
message,
|
|
||||||
f"❌ У вас уже есть активная задача для канала `{channel}`.\nВведите другой канал:"
|
|
||||||
)
|
|
||||||
return
|
|
||||||
# Удаляем промпт шага 1 перед отправкой шага 2
|
# Удаляем промпт шага 1 перед отправкой шага 2
|
||||||
if user_id in self._menu_msg:
|
if user_id in self._menu_msg:
|
||||||
await self._safe_delete(message.bot, message.chat.id, self._menu_msg.pop(user_id))
|
await self._safe_delete(message.bot, message.chat.id, self._menu_msg.pop(user_id))
|
||||||
|
|||||||
Reference in New Issue
Block a user