Files
fckbot/core/commands/other.py
Markov Andrey 42c14a1865 Add new file
2026-06-30 09:07:09 +00:00

35 lines
1.5 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 сброс истории диалога.
Сбрасывает историю в зависимости от контекста: в личном чате личную историю,
в групповом историю комнаты.
"""
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):
if room_jid:
await self.bot.db.clear_room_history(room_jid)
reply = msg.reply(f"🧹 История диалога комнаты {room_jid} сброшена.")
if reply:
reply.send() # исправлено
else:
logger.error("Не удалось отправить подтверждение сброса истории комнаты")
else:
await self.bot.db.clear_user_history(user_jid)
reply = msg.reply("🧹 Ваша личная история диалога сброшена.")
if reply:
reply.send() # исправлено
else:
logger.error("Не удалось отправить подтверждение сброса личной истории")
def get_help(self) -> str:
return "Сбрасывает историю диалога (личную или комнатную)."