Добавление работы с конфликтными частями и исправление вайтлиста
This commit is contained in:
@@ -99,7 +99,7 @@ async def add_conflict_word_cmd(message: Message) -> None:
|
||||
try:
|
||||
added = await manager.add_banword(
|
||||
word=word,
|
||||
word_type=BanWordType.CONFLICT_SUBSTRING,
|
||||
word_type=BanWordType.CONFLICT_WORD,
|
||||
added_by=message.from_user.id,
|
||||
reason="Конфликтное слово"
|
||||
)
|
||||
@@ -192,7 +192,7 @@ async def remove_conflict_word_cmd(message: Message) -> None:
|
||||
try:
|
||||
removed = await manager.remove_banword(
|
||||
word=word,
|
||||
word_type=BanWordType.CONFLICT_SUBSTRING
|
||||
word_type=BanWordType.CONFLICT_WORD
|
||||
)
|
||||
|
||||
if removed:
|
||||
@@ -433,3 +433,113 @@ async def conflict_status_cmd(message: Message) -> None:
|
||||
except Exception as e:
|
||||
logger.error(f"Ошибка получения статуса режима: {e}", log_type="CONFLICT")
|
||||
await message.answer("❌ <b>Ошибка получения статуса</b>", parse_mode="HTML")
|
||||
|
||||
|
||||
@router.message(
|
||||
Command(*COMMANDS.get("addconflictpart", ["addconflictpart"]),
|
||||
prefix=settings.PREFIX,
|
||||
ignore_case=True),
|
||||
IsAdmin()
|
||||
)
|
||||
@log_action(action_name="ADD_CONFLICT_PART", log_args=True)
|
||||
async def add_conflict_part_cmd(message: Message) -> None:
|
||||
"""
|
||||
Добавляет конфликтную часть.
|
||||
|
||||
Использование: /addconflictpart <комбинация>
|
||||
"""
|
||||
success, result = parse_conflict_args(
|
||||
message.text,
|
||||
"addconflictpart",
|
||||
need_minutes=False
|
||||
)
|
||||
|
||||
if not success:
|
||||
await message.answer(result, parse_mode="HTML")
|
||||
return
|
||||
|
||||
word = result[0].lower().strip()
|
||||
manager = get_manager()
|
||||
|
||||
try:
|
||||
added = await manager.add_banword(
|
||||
word=word,
|
||||
word_type=BanWordType.CONFLICT_PART,
|
||||
added_by=message.from_user.id,
|
||||
reason="Конфликтная часть"
|
||||
)
|
||||
|
||||
if added:
|
||||
text = (
|
||||
f"✅ <b>Конфликтная часть добавлена</b>\n\n"
|
||||
f"🧩 Часть: <code>{word}</code>\n"
|
||||
f"🔍 Тип: поиск без пробелов\n\n"
|
||||
f"⚔️ <i>Работает только в режиме антиконфликта</i>\n"
|
||||
f"Активируйте: <code>/stopconflict [минуты]</code>"
|
||||
)
|
||||
else:
|
||||
text = f"⚠️ Конфликтная часть <code>{word}</code> уже существует"
|
||||
|
||||
await message.answer(text, parse_mode="HTML")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"Ошибка добавления конфликтной части: {e}",
|
||||
log_type="CONFLICT"
|
||||
)
|
||||
await message.answer(
|
||||
"❌ <b>Ошибка добавления</b>\n\nПопробуйте позже",
|
||||
parse_mode="HTML"
|
||||
)
|
||||
|
||||
@router.message(
|
||||
Command(*COMMANDS.get("remconflictpart", ["remconflictpart"]),
|
||||
prefix=settings.PREFIX,
|
||||
ignore_case=True),
|
||||
IsAdmin()
|
||||
)
|
||||
@log_action(action_name="REMOVE_CONFLICT_PART", log_args=True)
|
||||
async def remove_conflict_part_cmd(message: Message) -> None:
|
||||
"""
|
||||
Удаляет конфликтную часть.
|
||||
|
||||
Использование: /remconflictpart <комбинация>
|
||||
"""
|
||||
success, result = parse_conflict_args(
|
||||
message.text,
|
||||
"remconflictpart",
|
||||
need_minutes=False
|
||||
)
|
||||
|
||||
if not success:
|
||||
await message.answer(result, parse_mode="HTML")
|
||||
return
|
||||
|
||||
word = result[0].lower().strip()
|
||||
manager = get_manager()
|
||||
|
||||
try:
|
||||
removed = await manager.remove_banword(
|
||||
word=word,
|
||||
word_type=BanWordType.CONFLICT_PART
|
||||
)
|
||||
|
||||
if removed:
|
||||
text = (
|
||||
f"🗑 <b>Конфликтная часть удалена</b>\n\n"
|
||||
f"🧩 Часть: <code>{word}</code>"
|
||||
)
|
||||
else:
|
||||
text = f"⚠️ Конфликтная часть <code>{word}</code> не найдена"
|
||||
|
||||
await message.answer(text, parse_mode="HTML")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(
|
||||
f"Ошибка удаления конфликтной части: {e}",
|
||||
log_type="CONFLICT"
|
||||
)
|
||||
await message.answer(
|
||||
"❌ <b>Ошибка удаления</b>\n\nПопробуйте позже",
|
||||
parse_mode="HTML"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user