Browse Source

Fixed shit

TheHamkerCat 5 years ago
parent
commit
d6091671d2
3 changed files with 28 additions and 4 deletions
  1. 24 0
      wbb/modules/arq.py
  2. 0 1
      wbb/modules/music.py
  3. 4 3
      wbb/modules/ocr.py

+ 24 - 0
wbb/modules/arq.py

@@ -1,3 +1,26 @@
+"""
+MIT License
+
+Copyright (c) 2021 TheHamkerCat
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+"""
 from wbb import app, arq, ARQ_API_BASE_URL
 from pyrogram import filters
 
@@ -26,5 +49,6 @@ async def arq_stats(_, message):
 **Disk:** `{disk}`
 **Platform:** `{platform}`
 **Python:** `{python_version}`
+**SERVER_URI**: {ARQ_API_BASE_URL}
 """
     await message.reply_text(statistics)

+ 0 - 1
wbb/modules/music.py

@@ -33,7 +33,6 @@ from pyrogram import filters
 from wbb import app, arq, SUDOERS
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.pastebin import paste
-from wbb.utils.functions import file_size_from_url
 
 
 __MODULE__ = "Music"

+ 4 - 3
wbb/modules/ocr.py

@@ -25,9 +25,9 @@ from wbb import app, arq
 from wbb.core.decorators.errors import capture_err
 from wbb.utils.functions import transfer_sh
 from pyrogram import filters
-from random import randint
 import os
 
+
 @app.on_message(filters.command("ocr"))
 @capture_err
 async def image_ocr(_, message):
@@ -70,10 +70,11 @@ async def image_ocr(_, message):
         if not reply.video.thumbs:
             return
         file_id = reply.video.thumbs[0].file_id
-
-    filename = f"{randint(1000, 10000)}.jpg"
     file = await app.download_media(file_id)
     url = await transfer_sh(file)
     os.remove(file)
     data = await arq.ocr(url)
+    if not data.ocr:
+        await m.edit("There's no text in that image.")
+        return
     await m.edit(data.ocr)