浏览代码

Deepsource hoe

TheHamkerCat 4 年之前
父节点
当前提交
895c8a1665
共有 2 个文件被更改,包括 3 次插入 和 8 次删除
  1. 2 2
      wbb/modules/music.py
  2. 1 6
      wbb/modules/userbot.py

+ 2 - 2
wbb/modules/music.py

@@ -48,7 +48,6 @@ is_downloading = False
 
 
 def download_youtube_audio(arq_resp):
-    global is_downloading
     r = arq_resp.result[0]
 
     title = r.title
@@ -61,6 +60,7 @@ def download_youtube_audio(arq_resp):
 
     if duration > 1800:
         return
+
     thumb = get(r.thumbnails[0]).content
     with open("thumbnail.png", "wb") as f:
         f.write(thumb)
@@ -71,7 +71,7 @@ def download_youtube_audio(arq_resp):
     audio = yt.streams.filter(only_audio=True).get_audio_only()
 
     out_file = audio.download()
-    base, ext = os.path.splitext(out_file)
+    base, _ = os.path.splitext(out_file)
     audio_file = base + ".mp3"
     os.rename(out_file, audio_file)
 

+ 1 - 6
wbb/modules/userbot.py

@@ -205,12 +205,7 @@ async def shellrunner(_, message: Message):
             )
         except Exception as err:
             print(err)
-            exc_type, exc_obj, exc_tb = sys.exc_info()
-            errors = traceback.format_exception(
-                etype=exc_type,
-                value=exc_obj,
-                tb=exc_tb,
-            )
+            errors = traceback.format_exc()
             return await eor(
                 message,
                 text=f"**INPUT:**\n```{escape(text)}```\n\n**ERROR:**\n```{''.join(errors)}```",