TheHamkerCat 5 лет назад
Родитель
Сommit
67493dc841
2 измененных файлов с 12 добавлено и 15 удалено
  1. 6 11
      wbb/core/tasks.py
  2. 6 4
      wbb/modules/userbot.py

+ 6 - 11
wbb/core/tasks.py

@@ -44,7 +44,7 @@ async def rm_task(task_id=None):
             if value[0].done() or value[0].cancelled():
             if value[0].done() or value[0].cancelled():
                 del tasks[key]
                 del tasks[key]
 
 
-        if task_id:
+        if task_id is not None:
             if task_id in tasks:
             if task_id in tasks:
                 if not tasks[task_id][0].done():
                 if not tasks[task_id][0].done():
                     tasks[task_id][0].cancel()
                     tasks[task_id][0].cancel()
@@ -59,22 +59,17 @@ async def rm_task(task_id=None):
 )
 )
 async def task_cancel(_, message: Message):
 async def task_cancel(_, message: Message):
     m = message
     m = message
-    r = m.reply_to_message
+    if len(message.text.split()) != 2:
+        return await m.delete()
 
 
-    if len(m.text.split()) == 2:
-        mid = int(m.text.split(None, 1)[1])
-    else:
-        mid = r.message_id if r else None
+    task_id = int(m.text.split(None, 1)[1])
 
 
     tasks = all_tasks()
     tasks = all_tasks()
 
 
-    if not mid or not tasks:
-        return await m.delete()
-
-    if mid not in tasks:
+    if task_id not in tasks:
         return await m.delete()
         return await m.delete()
 
 
-    await rm_task(mid)
+    await rm_task(task_id)
     await eor(message, text=f"{arrow(m)} Task cancelled")
     await eor(message, text=f"{arrow(m)} Task cancelled")
 
 
 
 

+ 6 - 4
wbb/modules/userbot.py

@@ -17,8 +17,8 @@ from pyrogram import filters
 from pyrogram.errors import MessageNotModified
 from pyrogram.errors import MessageNotModified
 from pyrogram.types import Message, ReplyKeyboardMarkup
 from pyrogram.types import Message, ReplyKeyboardMarkup
 
 
-from wbb import (SUDOERS, USERBOT_PREFIX, app, app2,  # don't remove
-                 arq, eor)
+from wbb import app2  # don't remove
+from wbb import SUDOERS, USERBOT_PREFIX, app, arq, eor
 from wbb.core.sections import section
 from wbb.core.sections import section
 from wbb.core.tasks import add_task, rm_task
 from wbb.core.tasks import add_task, rm_task
 
 
@@ -140,13 +140,15 @@ async def executor(client, message: Message):
             quote=False,
             quote=False,
         )
         )
         os.remove(filename)
         os.remove(filename)
-        return await status.delete()
+        if status:
+            await status.delete()
+        return
 
 
     # Edit the output if input is edited
     # Edit the output if input is edited
     if message.edit_date:
     if message.edit_date:
         status_ = await iter_edit(message, final_output)
         status_ = await iter_edit(message, final_output)
         if status_ == 0:
         if status_ == 0:
-            pass
+            return await message.reply(final_output, quote=True)
         else:
         else:
             return
             return
     await eor(status, text=final_output, quote=True)
     await eor(status, text=final_output, quote=True)