TheHamkerCat 5 years ago
parent
commit
2eb836094c
2 changed files with 16 additions and 3 deletions
  1. 1 1
      wbb/modules/global_stats.py
  2. 15 2
      wbb/modules/music.py

+ 1 - 1
wbb/modules/global_stats.py

@@ -92,11 +92,11 @@ async def global_stats(_, message):
 
 
 **Global Stats of {BOT_NAME}**:
 **Global Stats of {BOT_NAME}**:
 **{gbans}** Globally banned users.
 **{gbans}** Globally banned users.
-**{total_users}** Users, Across **{len(served_chats)}** chats.
 **{filters_count}** Filters, Across **{filters_chats_count}** chats.
 **{filters_count}** Filters, Across **{filters_chats_count}** chats.
 **{notes_count}** Notes, Across **{notes_chats_count}** chats.
 **{notes_count}** Notes, Across **{notes_chats_count}** chats.
 **{warns_count}** Warns, Across **{warns_chats_count}** chats.
 **{warns_count}** Warns, Across **{warns_chats_count}** chats.
 **{karmas_count}** Karma, Across **{karmas_chats_count}** chats.
 **{karmas_count}** Karma, Across **{karmas_chats_count}** chats.
+**{total_users}** Users, Across **{len(served_chats)}** chats.
 **{developers}** Developers And **{commits}** Commits On **[Github]({rurl})**."""
 **{developers}** Developers And **{commits}** Commits On **[Github]({rurl})**."""
 
 
     await m.edit(msg, disable_web_page_preview=True)
     await m.edit(msg, disable_web_page_preview=True)

+ 15 - 2
wbb/modules/music.py

@@ -81,16 +81,21 @@ async def download_song(url):
                 await f.close()
                 await f.close()
     return song_name
     return song_name
 
 
-
+is_downloading = False
 # Jiosaavn Music
 # Jiosaavn Music
 
 
 
 
 @app.on_message(filters.command("saavn") & ~filters.edited)
 @app.on_message(filters.command("saavn") & ~filters.edited)
 @capture_err
 @capture_err
 async def jssong(_, message):
 async def jssong(_, message):
+    global is_downloading
     if len(message.command) < 2:
     if len(message.command) < 2:
         await message.reply_text("/saavn requires an argument.")
         await message.reply_text("/saavn requires an argument.")
         return
         return
+    if is_downloading:
+        await message.reply_text("Another download is in progress, try again after sometime.")
+        return
+    is_downloading = True
     text = message.text.split(None, 1)[1]
     text = message.text.split(None, 1)[1]
     query = text.replace(" ", "%20")
     query = text.replace(" ", "%20")
     m = await message.reply_text("Searching...")
     m = await message.reply_text("Searching...")
@@ -109,9 +114,10 @@ async def jssong(_, message):
         os.remove(song)
         os.remove(song)
         await m.delete()
         await m.delete()
     except Exception as e:
     except Exception as e:
+        is_downloading = False
         await m.edit(str(e))
         await m.edit(str(e))
         return
         return
-
+    is_downloading = False
 
 
 # Deezer Music
 # Deezer Music
 
 
@@ -119,9 +125,14 @@ async def jssong(_, message):
 @app.on_message(filters.command("deezer") & ~filters.edited)
 @app.on_message(filters.command("deezer") & ~filters.edited)
 @capture_err
 @capture_err
 async def deezsong(_, message):
 async def deezsong(_, message):
+    global is_downloading
     if len(message.command) < 2:
     if len(message.command) < 2:
         await message.reply_text("/deezer requires an argument.")
         await message.reply_text("/deezer requires an argument.")
         return
         return
+    if is_downloading:
+        await message.reply_text("Another download is in progress, try again after sometime.")
+        return
+    is_downloading = True
     text = message.text.split(None, 1)[1]
     text = message.text.split(None, 1)[1]
     query = text.replace(" ", "%20")
     query = text.replace(" ", "%20")
     m = await message.reply_text("Searching...")
     m = await message.reply_text("Searching...")
@@ -140,5 +151,7 @@ async def deezsong(_, message):
         os.remove(song)
         os.remove(song)
         await m.delete()
         await m.delete()
     except Exception as e:
     except Exception as e:
+        is_downloading = False
         await m.edit(str(e))
         await m.edit(str(e))
         return
         return
+    is_downloading = False