Просмотр исходного кода

fix: karma & info + remove saavn

TheHamkerCat 2 лет назад
Родитель
Сommit
5bb0f0a32b
3 измененных файлов с 3 добавлено и 47 удалено
  1. 2 2
      wbb/modules/info.py
  2. 0 44
      wbb/modules/music.py
  3. 1 1
      wbb/utils/dbfunctions.py

+ 2 - 2
wbb/modules/info.py

@@ -73,7 +73,7 @@ async def get_chat_info(chat, already=False):
     chat_id = chat.id
     chat_id = chat.id
     username = chat.username
     username = chat.username
     title = chat.title
     title = chat.title
-    type_ = str(chat.type).split(".", 1)[1]
+    type_ = str(chat.type).split(".")[1]
     is_scam = chat.is_scam
     is_scam = chat.is_scam
     description = chat.description
     description = chat.description
     members = chat.members_count
     members = chat.members_count
@@ -111,7 +111,7 @@ async def info_func(_, message: Message):
     try:
     try:
         info_caption, photo_id = await get_user_info(user)
         info_caption, photo_id = await get_user_info(user)
     except Exception as e:
     except Exception as e:
-        return await m.edit(str(e))
+        return await m.edit(f"{str(e)}, Perhaps you meant to use /chat_info ?")
 
 
     if not photo_id:
     if not photo_id:
         return await m.edit(info_caption, disable_web_page_preview=True)
         return await m.edit(info_caption, disable_web_page_preview=True)

+ 0 - 44
wbb/modules/music.py

@@ -126,7 +126,6 @@ async def music(_, message):
     is_downloading = False
     is_downloading = False
 
 
 
 
-# Funtion To Download Song
 async def download_song(url):
 async def download_song(url):
     async with session.get(url) as resp:
     async with session.get(url) as resp:
         song = await resp.read()
         song = await resp.read()
@@ -135,49 +134,6 @@ async def download_song(url):
     return song
     return song
 
 
 
 
-# Jiosaavn Music
-
-
-@app.on_message(filters.command("saavn"))
-@capture_err
-async def jssong(_, message):
-    global is_downloading
-    if len(message.command) < 2:
-        return await message.reply_text("/saavn requires an argument.")
-    if is_downloading:
-        return await message.reply_text(
-            "Another download is in progress, try again after sometime."
-        )
-    is_downloading = True
-    text = message.text.split(None, 1)[1]
-    m = await message.reply_text("Searching...")
-    try:
-        songs = await arq.saavn(text)
-        if not songs.ok:
-            await m.edit(songs.result)
-            is_downloading = False
-            return
-        sname = songs.result[0].song
-        slink = songs.result[0].media_url
-        ssingers = songs.result[0].singers
-        sduration = songs.result[0].duration
-        await m.edit("Downloading")
-        song = await download_song(slink)
-        await m.edit("Uploading")
-        await message.reply_audio(
-            audio=song,
-            title=sname,
-            performer=ssingers,
-            duration=sduration,
-        )
-        await m.delete()
-    except Exception as e:
-        is_downloading = False
-        return await m.edit(str(e))
-    is_downloading = False
-    song.close()
-
-
 # Lyrics
 # Lyrics
 
 
 
 

+ 1 - 1
wbb/utils/dbfunctions.py

@@ -297,7 +297,7 @@ async def get_karmas_count() -> dict:
 async def user_global_karma(user_id) -> int:
 async def user_global_karma(user_id) -> int:
     total_karma = 0
     total_karma = 0
     async for chat in karmadb.find({"chat_id": {"$lt": 0}}):
     async for chat in karmadb.find({"chat_id": {"$lt": 0}}):
-        karma = await get_karma(chat["chat_id"], await int_to_alpha(user_id))
+        karma = chat["karma"].get(await int_to_alpha(user_id))
         if karma and (int(karma["karma"]) > 0):
         if karma and (int(karma["karma"]) > 0):
             total_karma += int(karma["karma"])
             total_karma += int(karma["karma"])
     return total_karma
     return total_karma