This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Telegram/modules/commands/cancel.py

12 lines
580 B
Python
Raw Normal View History

2022-12-23 02:40:23 +02:00
from app import app
from pyrogram import filters
2022-12-27 14:36:54 +02:00
from pyrogram.types import Message
from pyrogram.client import Client
2023-01-03 14:04:10 +02:00
from modules.utils import should_quote, logWrite, locale
from modules.database import col_tmp
2022-12-23 02:40:23 +02:00
@app.on_message(~ filters.scheduled & filters.command("cancel", prefixes=["/"]))
2022-12-27 14:36:54 +02:00
async def command_cancel(app: Client, msg: Message):
2023-01-03 14:04:10 +02:00
col_tmp.delete_many( {"user": msg.from_user.id} )
await msg.reply_text(locale("cancel", "message", locale=msg.from_user), quote=should_quote(msg))
logWrite(f"Cancelling all ongoing tmp operations for {msg.from_user.id}")