From 40de6c28851ffbeccf3344332ee72df4b502b565 Mon Sep 17 00:00:00 2001 From: Markov Andrey Date: Tue, 30 Jun 2026 21:49:43 +0000 Subject: [PATCH] Add new file --- bots/commands/reset.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 bots/commands/reset.py diff --git a/bots/commands/reset.py b/bots/commands/reset.py new file mode 100644 index 0000000..7d7a5c4 --- /dev/null +++ b/bots/commands/reset.py @@ -0,0 +1,31 @@ +# -*- 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 "Сбрасывает историю диалога (личную или комнатную)." \ No newline at end of file