From 43e71c95c4c988764cdc3f243361589a84b0fa5a Mon Sep 17 00:00:00 2001 From: profitroll Date: Sun, 26 Mar 2023 19:50:10 +0200 Subject: [PATCH] Cancel should also cancel the message listener --- modules/commands/cancel.py | 4 ++++ modules/commands/message.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/modules/commands/cancel.py b/modules/commands/cancel.py index c5e9b02..86fbe6b 100644 --- a/modules/commands/cancel.py +++ b/modules/commands/cancel.py @@ -16,6 +16,10 @@ from modules import custom_filters async def command_cancel(app: Client, msg: Message): col_tmp.delete_many({"user": msg.from_user.id, "sent": False}) col_spoilers.delete_many({"user": msg.from_user.id, "completed": False}) + try: + await app.listen.Cancel(filters.user(msg.from_user.id)) + except: + pass if col_applications.find_one({"user": msg.from_user.id}) is None: await msg.reply_text( locale("cancel_reapply", "message", locale=msg.from_user), diff --git a/modules/commands/message.py b/modules/commands/message.py index 22231d2..d1ba84c 100644 --- a/modules/commands/message.py +++ b/modules/commands/message.py @@ -64,6 +64,8 @@ async def cmd_message(app: Client, msg: Message): locale("message_enter", "message", locale=msg.from_user) ) message = await listen_message(app, msg.chat.id, timeout=None) + if message.text is not None and message.text == "/cancel": + return sent = await app.forward_messages( configGet("admin", "groups"), msg.chat.id, message.id )