Cancel command implemented

This commit is contained in:
2023-01-03 13:04:10 +01:00
parent b401028dd1
commit 7854f88217
2 changed files with 10 additions and 3 deletions

View File

@@ -2,8 +2,11 @@ from app import app
from pyrogram import filters
from pyrogram.types import Message
from pyrogram.client import Client
from modules.utils import should_quote
from modules.utils import should_quote, logWrite, locale
from modules.database import col_tmp
@app.on_message(~ filters.scheduled & filters.command("cancel", prefixes=["/"]))
async def command_cancel(app: Client, msg: Message):
await msg.reply_text("Command exists.", quote=should_quote(msg))
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}")