Files
fckbot/bots/commands/other.py
2026-06-30 21:41:19 +00:00

33 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""
Прочие команды: !reset сброс истории диалога.
Сбрасывает историю в зависимости от контекста: в личном чате личную историю,
в групповом историю комнаты.
Использует RAGClient.
"""
import logging
from core.commands.base import Command
logger = logging.getLogger(__name__)
class ResetCommand(Command):
name = "!reset"
aliases = ["/reset", "!сброс", "/сброс"]
async def execute(self, msg, args: str, user_jid: str, room_jid: str = None):
try:
result = await self.bot.rag_client.reset_history(user_jid, room_jid)
if result.get('status') == 'ok':
reply = msg.reply("🧹 История сброшена.")
else:
reply = msg.reply(f"❌ Ошибка сброса: {result}")
except Exception as e:
logger.exception(f"Ошибка в !reset: {e}")
reply = msg.reply(f"❌ Ошибка: {e}")
if reply:
reply.send()
def get_help(self) -> str:
return "Сбрасывает историю диалога (личную или комнатную)."