thehamkercat 5 anos atrás
pai
commit
3dae86026e
4 arquivos alterados com 23 adições e 10 exclusões
  1. 6 7
      README.md
  2. 1 1
      wbb/modules/arq.py
  3. 4 1
      wbb/modules/misc.py
  4. 12 1
      wbb/utils/inlinefuncs.py

+ 6 - 7
README.md

@@ -42,7 +42,7 @@ $ cp sample_config.py config.py
 ```
 Edit **config.py** with your own values
 
-# Run
+# Run Directly
 ```sh
 $ python3 -m wbb
 ```
@@ -56,7 +56,7 @@ $ git clone https://github.com/TheHamkerCat/WilliamButcherBot
 
 $ cd WilliamButcherBot
 
-$ pip3 install -U -r requirements.txt
+$ pip3 install pyrogram TgCrypto
 
 $ python3 str_gen.py
 ```
@@ -64,23 +64,22 @@ $ python3 str_gen.py
 [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/thehamkercat/WilliamButcherBot/)
 
 
-## Docker
+# Docker
 
 ```sh
-$ git clone https://github.com/TheHamkerCat/WilliamButcherBot && cd WilliamButcherBot
+$ git clone https://github.com/TheHamkerCat/WilliamButcherBot
+
+$ cd WilliamButcherBot
 
 $ cp sample_config.env config.env
 ```
 Edit **config.env** with your own values
 
-# Build & Run
-
 ```sh
 $ sudo docker build . -t wbb
 
 $ sudo docker run wbb
 ```
-To stop use `CTRL+C`
 
 ## Note
 

+ 1 - 1
wbb/modules/arq.py

@@ -56,4 +56,4 @@ async def arq_stats(_, message):
 **Bot:** {bot}
 **Address:** {ARQ_API_URL}
 """
-    await message.reply_text(statistics)
+    await message.reply_text(statistics, disable_web_page_preview=True)

+ 4 - 1
wbb/modules/misc.py

@@ -179,7 +179,10 @@ async def decrypt(_, message):
     text = message.reply_to_message.text
     text_in_bytes = bytes(text, "utf-8")
     cipher_suite = Fernet(FERNET_ENCRYPTION_KEY)
-    decoded_text = cipher_suite.decrypt(text_in_bytes)
+    try:
+        decoded_text = cipher_suite.decrypt(text_in_bytes)
+    except Exception:
+        return await message.reply_text("Incorrect token")
     bytes_in_text = decoded_text.decode("utf-8")
     await message.reply_text(bytes_in_text)
 

+ 12 - 1
wbb/utils/inlinefuncs.py

@@ -745,7 +745,18 @@ async def yt_music_func(answers, url):
 
 
 async def user_info_inline_func(answers, user):
-    caption, photo_id = await get_user_info(user)
+    try:
+        caption, _ = await get_user_info(user)
+    except Exception:
+        answers.append(
+                InlineQueryResultArticle(
+                    title="USER NOT FOUND",
+                    input_message_content=InputTextMessageContent(
+                        "USER NOT FOUND"
+                        )
+                    )
+                )
+        return answers
     answers.append(
         InlineQueryResultArticle(
             title="Found User.",